fnhdx
fnhdx

Reputation: 321

how to improve orb feature matching?

I am trying to register two binary images. I used opencv orb detector and matcher to generate and match feature points. However, the matching result looks bad. Can anybody tell me why and how to improve? Thanks. Here are the images and matching result.

enter image description here

enter image description here

enter image description here

Here is the code

OrbFeatureDetector detector; //OrbFeatureDetector detector;SurfFeatureDetector
vector<KeyPoint> keypoints1;
detector.detect(im_edge1, keypoints1);
vector<KeyPoint> keypoints2;
detector.detect(im_edge2, keypoints2);

OrbDescriptorExtractor extractor; //OrbDescriptorExtractor extractor; SurfDescriptorExtractor extractor;
Mat descriptors_1, descriptors_2;
extractor.compute( im_edge1, keypoints1, descriptors_1 );
extractor.compute( im_edge2, keypoints2, descriptors_2 );

//-- Step 3: Matching descriptor vectors with a brute force matcher
BFMatcher matcher(NORM_L2, true);   //BFMatcher matcher(NORM_L2);

vector< DMatch> matches;
matcher.match(descriptors_1, descriptors_2, matches);


vector< DMatch > good_matches;
vector<Point2f> featurePoints1;
vector<Point2f> featurePoints2;
for(int i=0; i<int(matches.size()); i++){
    good_matches.push_back(matches[i]);
}

//-- Draw only "good" matches
Mat img_matches;
imwrite("img_matches_orb.bmp", img_matches);

Upvotes: 3

Views: 12709

Answers (2)

Laurent Mennillo
Laurent Mennillo

Reputation: 21

ORB descriptors are, unlike SURF, binary descriptors. The HAMMING distance is suited for binary descriptors comparison. Use NORM_HAMMING when initializing your BFMatcher.

Upvotes: 2

Kaiwen
Kaiwen

Reputation: 145

Some answers there may be helpful: Improve matching of feature points with OpenCV

It's for SIFT descriptor, but we can also use them for ORB matching:)

Upvotes: 1

Related Questions