我有一个关于与OpenCV匹配的对象的问题.我正在使用opencv 2.3中实现的SURF算法来首先检测每个图像上的特征,然后提取这些特征的描述符.使用Brute Force Matcher进行匹配的问题,我不知道如何判断两个图像是否匹配,就像我使用两个不同的图像一样,两个图像中的描述符之间存在线条!
我的代码的这些输出,无论是两个图像 - 我与它们进行比较 - 都相似或不同,结果图像表明两个图像是匹配的.
问题是:我如何区分这两个图像?
真实匹配:

假匹配!! :

我的代码:
Mat image1, outImg1, image2, outImg2;
// vector of keypoints
vector<KeyPoint> keypoints1, keypoints2;
// Read input images
image1 = imread("C://Google-Logo.jpg",0);
image2 = imread("C://Alex_Eng.jpg",0);
SurfFeatureDetector surf(2500);
surf.detect(image1, keypoints1);
surf.detect(image2, keypoints2);
drawKeypoints(image1, keypoints1, outImg1, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
drawKeypoints(image2, keypoints2, outImg2, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
namedWindow("SURF detector img1");
imshow("SURF detector img1", outImg1);
namedWindow("SURF detector img2");
imshow("SURF detector img2", outImg2);
SurfDescriptorExtractor surfDesc;
Mat descriptors1, descriptors2;
surfDesc.compute(image1, keypoints1, descriptors1);
surfDesc.compute(image2, keypoints2, descriptors2);
BruteForceMatcher<L2<float>> matcher;
vector<DMatch> …Run Code Online (Sandbox Code Playgroud) 我在OpenCV中进行物体检测项目,包括将模板图像中的对象与参考图像进行匹配.使用SIFT算法,功能得到精确检测和匹配,但我想在匹配的功能周围使用直肠我的算法使用KD-Tree est ean First技术来获得匹配