Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV ORB detector finds very few keypoints

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.

This image shows the keypoints found by the ORB detector:

enter image description here

and this image shows the keypoints found by the SIFT detection stage (FAST returns a similar number of points).

enter image description here

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.

Why such a big difference?

Code:

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()
like image 335
coderunner Avatar asked Sep 21 '15 18:09

coderunner


People also ask

How does Orb feature detector work?

ORB uses BRIEF descriptors but as the BRIEF performs poorly with rotation. So what ORB does is to rotate the BRIEF according to the orientation of keypoints. Using the orientation of the patch, its rotation matrix is found and rotates the BRIEF to get the rotated version.

What is Orb in cv2?

ORB is basically a fusion of FAST keypoint detector and BRIEF descriptor with many modifications to enhance the performance. First it use FAST to find keypoints, then apply Harris corner measure to find top N points among them. It also use pyramid to produce multiscale-features.

What is sift in OpenCV?

SIFT (Scale Invariant Fourier Transform) Detector is used in the detection of interest points on an input image. It allows identification of localized features in images which is essential in applications such as: Object Recognition in Images.

What is Keypoint OpenCV?

Introduction to OpenCV KeyPoint. The points or spatial locations in a given image which defines whatever stands out in the image is called keypoint.


1 Answers

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)

enter image description here

orb = cv2.ORB_create(nfeatures=100000, scoreType=cv2.ORB_FAST_SCORE)

enter image description here

like image 158
iabdalkader Avatar answered Sep 23 '22 19:09

iabdalkader