# 代码来自:
https://www.cnblogs.com/ssyfj/p/9271883.htmlimport cv2 as cv
import numpy as np
FULL='a2.png'
TEMP='a1.png'
tpl = cv.imread(TEMP)
target = cv.imread(FULL)
tpl = cv.Canny(tpl,80,150,(3,3))
target = cv.Canny(target,80,150,(3,3))
cv.imshow("template image",tpl)
cv.imshow("target image",target)
result = cv.matchTemplate(target,tpl,cv.TM_CCORR_NORMED)
min_val,max_val,min_loc,max_loc = cv.minMaxLoc(result)
tl = max_loc
th,tw = tpl.shape[:2] #获取模板图像的高宽
br = (tl[0]+tw,tl[1]+th) #右下点
cv.rectangle(target,tl,br,(255,255,255),2) #画矩形
cv.imshow("match",target)
cv.waitKey(0)
cv.destroyAllWindows()
【 在 feng321 的大作中提到: 】
: 谢谢,处理了,还是不行啊。大神,能否留个qq或者微信啊?谢谢
: [upload=1][/upload]
--
修改:k7amd FROM 124.64.17.*
FROM 124.64.17.*