|
123456789101112131415161718192021 |
- import cv2
-
- target = cv2.imread("image/AI.jpg")
-
- template = cv2.imread("image/AI1.jpg")
-
- theight, twidth = template.shape[:2]
-
- result = cv2.matchTemplate(target,template,cv2.TM_CCOEFF_NORMED)
- print(result)
- cv2.normalize( result, result, 0, 1, cv2.NORM_MINMAX, -1 )
-
- min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(result)
- print(min_val, max_val, max_loc)
- strmin_val = str(min_val)
-
- cv2.rectangle(target,min_loc,(min_loc[0]+twidth,min_loc[1]+theight),(0,0,225),2)
-
- # cv2.imshow("MatchResult----MatchingValue="+strmin_val,target)
- # cv2.waitKey()
- # cv2.destroyAllWindows()
|