![](/img/trans.png)
[英]How to get the positions of the matched points with Brute-Force Matching / SIFT Descriptors
[英]SIFT or SURF - Provide key points and retrieve descriptors
我正在嘗試使用OpenCV(2.4.6.0)從我提供的關鍵點檢索描述符。
到目前為止,我還沒有成功......
l, des = surf.detectAndCompute(self.gray,None,useProvidedKeypoints = True)
其中l
是一個特征點數組。 我不知道在哪里輸入我已經擁有的關鍵點...
有誰知道如何使用SIFT或SURF進行此操作?
謝謝您的幫助!
這看起來像是detectAndCompute()
的Python綁定問題,因為C ++等價物允許輸入關鍵點。 幸運的是,有一種解決方法。 如果您已經檢測到關鍵點並將它們存儲在l
,那么您可以為所提供的關鍵點創建DescriptorExtractor
對象並計算描述符。
生成FAST關鍵點然后計算SURF描述符的示例如下:
im = cv2.imread(path_to_image)
fast = cv2.FeatureDetector_create('FAST')
l = fast.detect(im)
surf = cv2.DescriptorExtractor_create('SURF')
l, des = surf.compute(im, l)
這同樣適用於SIFT功能。 只需將'SIFT'
作為參數傳遞給cv2.DescriptorExtractor_create()
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.