如何改进orb特征匹配?

时间:2016-04-18 18:08:06

标签: c++ opencv feature-detection surf orb

我正在尝试注册两个二进制图像。我使用opencv orb探测器和匹配器来生成和匹配特征点。但是,匹配结果看起来很糟糕。谁能告诉我为什么以及如何改进?谢谢。 这是图像和匹配结果。

enter image description here

enter image description here

enter image description here

这是代码

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);

2 个答案:

答案 0 :(得分:1)

有些答案可能有帮助: Improve matching of feature points with OpenCV

它适用于SIFT描述符,但我们也可以将它们用于ORB匹配:)

答案 1 :(得分:0)

ORB不同,

SURF描述符是二进制描述符。 HAMMING距离适合二进制描述符比较。初始化NORM_HAMMING时使用BFMatcher

相关问题