[英]OpenCV ORB features
我正在使用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);
也許有人對此有所了解?
事實並非如此。.您應該獲得一致的性能。 但是,我正在共享我的代碼,以便在兩個圖像上使用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;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.