Why is max not equal to beta after using normalize?

asked 2019-09-18 08:58:44 -0500

AndreasM gravatar image

I'm doing a simple template matching on an RGB image with an RGB template cut from that exact image (so I know the template has a 100% match). After running cv2.matchTemplate(subject, template, cv2.TM_CCORR), I get a match image with some values.

In order to visualize it, I then use cv2.normalize(match, 0, 255). The visualization looks nice: The resulting image has bright spots on potential matches. After that operation, I would expect the max value of the resulting array to be 255. However, np.max(normalized) returns 0.709. What is it that I have misunderstood?

My full code is here:

template = cv2.imread("template.png")
subject = cv2.imread("subject.png")

match = cv2.matchTemplate(subject, template, cv2.TM_CCORR)
normalized = cv2.normalize(match, 0, 255)
edit retag flag offensive close merge delete