我正在使用ORB特征检测器和提取器从灰度图像列表中获取特征。问题是,如果我多次尝试检测\提取图像,我会从同一图像中获得不同的特征。因此,不可能在以后使用它们进行检测。
代码:
bmp=BitmapFactory.decodeResource(getResources(),R.drawable.t1);
Utils.bitmapToMat(bmp, mat);
FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB);
detector.detect(mat, keypoints);
DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.ORB);
extractor.compute(mat, keypoints, features);也许有人对此有所了解?
发布于 2013-01-14 15:39:21
这不应该是case..you应该获得一致的性能。然而,我分享了我的代码,以便在两个图像上使用Orb特征检测器以及Orb描述符提取器。您可以使用任何匹配器来匹配它们。希望这能帮到你。
#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;
}https://stackoverflow.com/questions/14314526
复制相似问题