我使用相同大小的二进制图像,提取ORB特征,但是当要比较描述符时,我收到一个:
错误
OpenCV/opencv/modules/core/src/stat.cpp:3757: error: (-215) type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U) in function batchDistance
但是当我用
print img.dtype, np.shape(img), np.shape(descriptors)
print oldimg.dtype, np.shape(oldimg), np.shape(olddescriptors)
我明白了
^{pr2}$显然这似乎是个错误。另一方面,我也无能为力。有人知道吗?至少网上有一些关于如何手动匹配描述符的教程?在
顺便说一句,如果我使用SIFT、SURF等,也是一样的
这是我的代码:
我正在使用python2.7和opencv2.4
orb = cv2.ORB_create(edgeThreshold=3)
oldkeypoints, olddescriptors = orb.detectAndCompute(oldimg,None)
keypoints, descriptors = orb.detectAndCompute(img,None)
bf = cv2.BFMatcher(cv2.NORM_HAMMING)
bf.clear()
bf.add(olddescriptors)
bf.train()
matches = bf.match(descriptors) # crashes here
matches = sorted(matches, key = lambda x:x.distance)
目前没有回答
相关问题 更多 >
编程相关推荐