我正在编写基于surf的图像匹配算法。我用 400 hessian 阈值初始化 surf:
surf = cv2.SURF(400)
并做了flann匹配。
但它运行得太慢(在大量图像上)。然后我决定先做轻度测试,然后进行深度测试。所以我把粗麻布阈值改为1200。
surf = cv2.SURF(1200)
现在快多了。
matches = flann.knnMatch(des1,des2,k=2)
但在某些图像上,它会引发以下错误:
OpenCV Error: Assertion failed ((globalDescIdx>=0) && (globalDescIdx < size())) in getLocalIdx, file /tmp/opencv-2.4.10/modules/features2d/src/matchers.cpp, line 163
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "indexThreadsDeep.py", line 97, in threadRun
if(imageMatch(qDes,tDes)):
File "indexThreadsDeep.py", line 69, in imageMatch
matches = flann.knnMatch(des1,des2,k=2)
error: /tmp/opencv-2.4.10/modules/features2d/src/matchers.cpp:163: error: (-215) (globalDescIdx>=0) && (globalDescIdx < size()) in function getLocalIdx