Compares a template against overlapped image regions.
Parameters: |
|
---|
The function is similar to CalcBackProjectPatch . It slides through image , compares the overlapped patches of size against templ using the specified method and stores the comparison results to result . Here are the formulas for the different comparison methods one may use ( denotes image , template , result ). The summation is done over template and/or the image patch:
method=CV_TM_SQDIFF
method=CV_TM_SQDIFF_NORMED
method=CV_TM_CCORR
method=CV_TM_CCORR_NORMED
method=CV_TM_CCOEFF
where
method=CV_TM_CCOEFF_NORMED
After the function finishes the comparison, the best matches can be found as global minimums ( CV_TM_SQDIFF ) or maximums ( CV_TM_CCORR and CV_TM_CCOEFF ) using the MinMaxLoc function. In the 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).