1 | initial version |
Looking at the description of the actual method:
void matchTemplate(InputArray image, InputArray templ, OutputArray result, int method)
It states that the results are stored in a comparison results map.
Beneath the explanation you can find this text:
After the function finishes the comparison, the best matches can be found as global minimums (when CV_TM_SQDIFF was used) or maximums (when CV_TM_CCORR or CV_TM_CCOEFF was used) using the minMaxLoc() function. In case of a color image, template summation in the numerator and each sum in the denominator is done over all of the channels and separate mean values are used for each channel. That is, the function can take a color template and a color image. The result will still be a single-channel image, which is easier to analyze.
So basically try to find global maxima in the output map. This means you need to go over your output matrix and look for maximal values.
2 | No.2 Revision |
Looking at the description of the actual method:
void matchTemplate(InputArray image, InputArray templ, OutputArray result, int method)
It states that the results are stored in a comparison results map.
Beneath the explanation you can find this text:
After the function finishes the comparison, the best matches can be found as global minimums (when CV_TM_SQDIFF was used) or maximums (when CV_TM_CCORR or CV_TM_CCOEFF was used) using the minMaxLoc() function. In case of a color image, template summation in the numerator and each sum in the denominator is done over all of the channels and separate mean values are used for each channel. That is, the function can take a color template and a color image. The result will still be a single-channel image, which is easier to analyze.
So basically try to find global maxima in the output map. This means you need to go over your output matrix and look for maximal values.
ADDITION 1
--> go read tutorial on template matching, it is all explained there:
http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html