Created
June 16, 2015 14:22
-
-
Save G07cha/742a1b0acad05077cdf1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import sys | |
from matplotlib import pyplot as plt | |
#Path to image containing fragment | |
img = cv2.imread(sys.argv[1], 0) | |
#Path to fragment | |
template = cv2.imread(sys.argv[2], 0) | |
method = 'cv2.TM_CCOEFF' | |
# Apply template Matching | |
res = cv2.matchTemplate(img, template, eval(method)) | |
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res) | |
#Will return coords of top left corner | |
sys.stdout.write("%s;%s" % (max_loc[0], max_loc[1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment