How it works...

cv2.matchTemplate is used to find image regions that are similar to the template. The similarity can be determined with different methods (different mathematical operations to get the difference between the template and a patch on the image). But, none of these methods are able to find templates with different scales or orientations.

This function takes source image, search template, and the method of patch and template comparison. The methods are determined by these values: cv2.TM_CCOEFF, cv2.TM_CCOEFF_NORMED, cv2.TM_CCORR, cv2.TM_CCORR_NORMED, cv2.TM_SQDIFF or cv2.TM_SQDIFF_NORMED. The methods with CCOEFF in the name use correlation coefficient computation, like the similarity measure—the bigger the value, the more similar ...

Get OpenCV 3 Computer Vision with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.