2017-01-17 218 views
1

我正在編寫基於surf的圖像匹配算法。 我用400大麻閾值初始化衝浪:flann knnmatch中的OpenCV錯誤

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 

回答

1

這個問題是因爲即將到期的高門檻海森有在knnMatch一些images.But我一直在尋找只有一個關鍵點最近的兩個鄰居。