Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Max value of TemplateMatching without normalization

Hi,

I have been using template matching for my work a lot and I know the template matching method returns "the best match" over the whole image even though there is no such shape. And if I normalize the map, the max value always hikes to the max value even though its confidence is very bad.

So I am looking for a way to calculate the max value that template matching calculation can possibly make. (It's different from max value of the map)

Let's say template image size is 10x10 with gray scale. What is the max value of the map which is created by template matching method? I am using TM_CCOEFF_NORMED but I am open to other methods too depends on how easy calculating max value is.

res = cv2.matchTemplate(img,template,method)
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
// max_val is just a max value in res
// I wanna know how confident max_val is comparing to the possibly maximum value.