Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Calculation of TM_CCOEFF_NORMED for template matching

This template image below gives always 1.0:

Flat template

best matching result in every source image. @pklab said here it is because the formula of TM_CCOEFF_NORMED returns 0/0 because the template image is constant color and opencv returns 1.0 to avoid match exception, but I still don't get it. I would understand better with an example, lets say template image = 3x4 pixels and source image = 10x12 pixels, could someone put the values in the formula please and show 0/0?