这不应该是这种情况..您应该获得一致的性能。但是,我正在共享我的代码以在两个图像上使用 Orb 特征检测器以及 Orb Descriptor Extractor。您可以使用任何匹配器来匹配它们。希望这可以帮助你...
#include "iostream"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/nonfree/nonfree.hpp>
#include <opencv2/nonfree/features2d.hpp>
#include <opencv2/flann/flann.hpp>
#include <opencv2/legacy/legacy.hpp>
#include <vector>
using namespace cv;
using namespace std;
int main()
{
Mat image1,image2;
imageA = imread("C:\\lena.jpg",0);
imageB = imread("C:\\lena1.bmp",0);
vector<KeyPoint> keypointsA,keypointsB;
Mat descriptorsA,descriptorsB;
std::vector<DMatch> matches;
OrbFeatureDetector detector;
OrbDescriptorExtractor extractor;
BruteForceMatcher<Hamming> matcher;
detector.detect(imageA,keypointsA);
detector.detect(imageB,keypointsB);
extractor.compute(imageA,keypointsA,descriptorsA);
extractor.compute(imageB,keypointsB,descriptorsB);
return 0;
}