C++ 如何改进orb特征匹配?

C++ 如何改进orb特征匹配?,c++,opencv,feature-detection,surf,orb,C++,Opencv,Feature Detection,Surf,Orb,我正在尝试注册两个二进制图像。我使用opencv orb检测器和匹配器来生成和匹配特征点。但是,匹配结果看起来很糟糕。谁能告诉我为什么以及如何改进?谢谢 这是图像和匹配结果 这是密码 OrbFeatureDetector detector; //OrbFeatureDetector detector;SurfFeatureDetector vector<KeyPoint> keypoints1; detector.detect(im_edge1, keypoints1); ve

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

这是密码

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);
OrbFeatureDetector//特征检测器;表面特征检测器
向量关键点1;
检测器。检测(im_edge1,关键点1);
向量关键点2;
检测器。检测(IMU边缘2,关键点2);
ORB牵引器//ORB牵引器;表面描述符牵引器;
Mat描述符_1,描述符_2;
提取器.compute(im_edge1,keypoints1,描述符_1);
提取器.compute(im_edge2,keypoints2,描述符_2);
//--步骤3:使用蛮力匹配器匹配描述符向量
BFMatcher匹配器(NORM_L2,true)//BFMatcher匹配器(NORM_L2);
向量匹配;
matcher.match(描述符_1,描述符_2,matches);
向量良好匹配;
向量特征点1;
向量特征点2;

对于(int i=0;i一些答案可能有帮助:


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

ORB
描述符与
SURF
不同,是二进制描述符。
HAMMING
距离适合于二进制描述符的比较。使用
NORM\u HAMMING
初始化您的
bMatcher

您能分享一些代码吗?您好,我添加了我的代码。您可以跟踪最佳匹配和次优匹配。如果两者有相似的品质,你无法决定,所以你会放弃那场比赛