import cv2 method = cv2.TM_SQDIFF_NORMED small = cv2.imread('small.png') large = cv2.imread('large.png') result = cv2.matchTemplate(small,large,method) mn,_,mnLoc,_=cv2.minMaxLoc(result) MPx,MPy = mnLoc trows,tcols = small.shape[:2] cv2.rectangle(large,(MPx,MPy),(MPx+tcols,MPy+trows),(0,0,255),2) cv2.imshow('output',large) cv2.waitKey(0)