1 | initial version |
Template matching measure the difference between a template and a region of your image. There are different way to calculate
SQDIFF calculates the difference than best match have 0
CCORR e COEFF calculates the similarity than best match have 100%
In my experience SQDIFF and COEFF are less robust than CCORR.
Using NORMED version of algorithms you will have a result within the range of 0..1 where 1 means perfect matching (with SQDIFF 0 means perfect) so you can set a threshold for accept/discard the matching.
You could accept matching where the score is more than 0.9 (or less than 0.1 is SQDIFF)
Be careful because the examples uses to normalize (again) the result of the matching. If you do this you will have always a matching with max score because of successive normalization.