import cv2
import numpy as np
origin = cv2.imread('./image/many-cat.png')
origin_gray= cv2.cvtColor(origin,cv2.COLOR_BGR2GRAY)
template = cv2.imread('./image/min-cat.png',0)
print(template.shape)
h,w = template.shape
res = cv2.matchTemplate(origin_gray,template,cv2.TM_CCOEFF_NORMED)
threshold = 0.98
loc = np.argwhere(res>=threshold)
for pt in loc:
bottom_right = (pt[1] + w,pt[0] + h)
cv2.rectangle(origin,pt[::-1],bottom_right,(0,0,255),2)
cv2.imshow('origin',origin)
cv2.waitKey(0)
cv2.destroyAllWindows()