result = cv2.matchTemplate(scene_gray, template_gray, cv2.TM_SQDIFF_NORMED) best_difference, _, top_left, _ = cv2.minMaxLoc(result) height, width = template_gray.shape bottom_right = (top_left[0] + width, top_left[1] + height)