問題描述
我正在嘗試使用 ORB 關(guān)鍵點(diǎn)檢測器,它返回的點(diǎn)似乎比 SIFT 檢測器和 FAST 檢測器少得多.
I'm trying to use the ORB keypoint detector and it seems to be returning much fewer points than the SIFT detector and the FAST detector.
此圖顯示了 ORB 檢測器發(fā)現(xiàn)的關(guān)鍵點(diǎn):
This image shows the keypoints found by the ORB detector:
這張圖顯示了 SIFT 檢測階段發(fā)現(xiàn)的關(guān)鍵點(diǎn)(FAST 返回的點(diǎn)數(shù)相似).
and this image shows the keypoints found by the SIFT detection stage (FAST returns a similar number of points).
只有這么少的點(diǎn)會(huì)導(dǎo)致跨圖像的特征匹配結(jié)果非常差.我現(xiàn)在只是對 ORB 的檢測階段感到好奇,因?yàn)檫@似乎我得到了不正確的結(jié)果.我已經(jīng)嘗試使用 ORB 檢測器和默認(rèn)參數(shù)以及下面詳述的自定義參數(shù).
Having such few points is resulting in very poor feature matching results across images. I'm just curious about the detection stage of ORB right now though because this seems like I'm getting incorrect results. I've tried using the ORB detector with default parameters and also custom parameters detailed below as well.
為什么會(huì)有這么大的差異?
Why such a big difference?
代碼:
orb = cv2.ORB_create(edgeThreshold=15, patchSize=31, nlevels=8, fastThreshold=20, scaleFactor=1.2, WTA_K=2,scoreType=cv2.ORB_HARRIS_SCORE, firstLevel=0, nfeatures=500)
#orb = cv2.ORB_create()
kp2 = orb.detect(img2)
img2_kp = cv2.drawKeypoints(img2, kp2, None, color=(0,255,0),
flags=cv2.DrawMatchesFlags_DEFAULT)
plt.figure()
plt.imshow(img2_kp)
plt.show()
推薦答案
增加 nfeatures 會(huì)增加檢測到的角點(diǎn)的數(shù)量.關(guān)鍵點(diǎn)提取器的類型似乎無關(guān)緊要.我不確定如何將此參數(shù)傳遞給 FAST 或 Harris,但它似乎可以工作.
Increasing nfeatures increases the number of detected corners. The type of keypoint extractor seems irrelevant. I'm not sure how this parameter is passed to FAST or Harris but it seems to work.
orb = cv2.ORB_create(scoreType=cv2.ORB_FAST_SCORE)
orb = cv2.ORB_create(nfeatures=100000, scoreType=cv2.ORB_FAST_SCORE)
這篇關(guān)于OpenCV ORB 檢測器發(fā)現(xiàn)的關(guān)鍵點(diǎn)很少的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!