【发布时间】:2019-09-03 22:13:08
【问题描述】:
我试图删除我得到结果的部分,但只是以相反的顺序。所以我这里的问题是,我们为什么要使用那部分来拼接数组。
import numpy as np
import cv2
img = cv2.imread("E:/tmp/pis.jpg")
template = cv2.imread("E:/tmp/pi templates.jpg",0)
img_gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
w,h = template.shape[::-1]
res = cv2.matchTemplate(img_gray,template,cv2.TM_CCOEFF_NORMED)
threshold = 0.6
loc = np.where(res>=threshold)
for pt in zip(*loc[::-1]):
cv2.rectangle(img,pt,(pt[0]+w,pt[1]+h),(255,255,255),1)
cv2.imshow("img",img)
cv2.waitKey(0)
cv2.destroyAllWindows()
【问题讨论】:
-
您对哪一行感到困惑?
标签: python python-3.x list numpy slice