OpenCV ORB特征

我使用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; }

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注