Created
February 28, 2015 14:41
-
-
Save oskardahlberg/a9bfd1916d923b765631 to your computer and use it in GitHub Desktop.
templateMatches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here is the implementation | |
https://github.com/peterbraden/node-opencv/blob/master/src/Matrix.cc#L1736 | |
The argument preprocessing is bad, you should probably specify all. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var matchMatrix = sourceMatrix.matchTemplate(targetMatrix, 0 /* TM_SQDIFF */); | |
var matches = matchMatrix.templateMatches( | |
minProbability, | |
maxProbability, | |
limit, | |
ascending, // true/false, lower probability score is better, use for TM_SQDIFF/0 and TM_SQDIFF_NORMED/1 | |
minXDistance, | |
minYDistance | |
); | |
// matches is now an array of matches sorted by probability | |
// each match has properties x, y and probability | |
// minXDistance and minYDistance is optionally used to filter out the best of neighbouring matches | |
// so if you dont want to find overlapping matches, set these to targetWidth/2 and targetHeight/2 as ints. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment