I used this code to do some template matching:
import cv2
import numpy
large_image = cv2.imread('image1.png')
small_image = cv2.imread('image2.png')
null, w, h = small_image.shape[::-1]
res = cv2.matchTemplate(large_image, small_image, cv2.TM_CCOEFF_NORMED)
loc = numpy.where(res >= 0.7)
for pt in zip(*loc[::-1]):
suh = cv2.rectangle(small_image, pt, (pt[0] + w, pt[1] + h), (0, 66, 255), 1)
cv2.imwrite('something.png', suh)
large_image is this one: C:\fakepath\image1.png small_image is this one: C:\fakepath\image2.png
The rectangle was created so that part worked, but I just wanted the two coordinates of the top left either checker boards. I wanted to use the pt variable, but there are too many of them and I don't know what they mean. How can I get the location in pixels of either boxes?