Ask Your Question

Revision history [back]

Need clarification on matchTemplate

I am working with the matchTemplate function to locate the template in an image. I have gone over the tutorial and the documentation on the six different methods to do the job. I have started to use TM_COEFF_NORMED for my application but it seems to give me a result that is slightly displaced. I have checked my code over and over again but unable to find the cause for displacement.

Another question that comes to my mind is the circumstances in which the different methods may be more applicable. In particular, I'm interested in finding out when I should use TM_COEFF_NORMED vs TM_CORR_NORMED. I can see the mathematical formulas but am looking for guidance from someone experience on when I should be using a particular method.

I'll certainly appreciate any help I can get here.

click to hide/show revision 2
Added the URLs for documentation and tutorial.

Need clarification on matchTemplate

I am working with the matchTemplate function to locate the template in an image. I have gone over the tutorial and the documentation on the six different methods to do the job. I have started to use TM_COEFF_NORMED for my application but it seems to give me a result that is slightly displaced. I have checked my code over and over again but unable to find the cause for displacement.

The relevant URLs are: - http://docs.opencv.org/modules/imgproc/doc/object_detection.html?highlight=best%20match - http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html

Another question that comes to my mind is the circumstances in which the different methods may be more applicable. In particular, I'm interested in finding out when I should use TM_COEFF_NORMED vs TM_CORR_NORMED. I can see the mathematical formulas but am looking for guidance from someone experience on when I should be using a particular method.

I'll certainly appreciate any help I can get here.