看一下下面的代码。
import cv
import cv2
print "starting now"
im = cv.CaptureFromCAM(0)
template=cv.LoadImage("/home/patrick/Desktop/card.JPG")
W=3648
H=2736
w,h = cv.GetSize(template)
width = W - w + 1
height = H - h + 1
result = cv.CreateImage((width, height), 32, 1)
#image= cv.CreateImage((width, height), 32, 1)
cv.MatchTemplate(im, template, result, cv.CV_TM_CCORR)
(min_x, max_y, minloc, maxloc) = cv.MinMaxLoc(result)
(x, y) = minloc
print (x,y)
当我跑步时,我得到了呃错误信息
cv.MatchTemplate(im, template, result, cv.CV_TM_CCORR)
TypeError: CvArr argument 'image' must be IplImage, CvMat or CvMatND. Use fromarray() to convert numpy arrays to CvMat or cvMatND
如何将网络摄像头中的图像转换为可以使用匹配模板处理的数据?