视觉SLAM/opencv特征匹配相关函数
1、提取特征FeatureDetector
1.1用法:
Ptr<FeatureDetector> detecor = ORB::create();/Ptr<ORB> detecor = ORB::create();/Ptr<SURF> detector = SURF::create( minHessian );
vector<KeyPoint> keypoints_1;
detector->detect( img_1, keypoints_1);
1.2数据结构:


1.3其中的成员函数detect的数据结构

1.4其中ORB::Create函数的数据结构
CV_WRAP static Ptr<ORB> create(int nfeatures=500, float scaleFactor=1.2f, int nlevels=8, int edgeThreshold=31,
int firstLevel=0, int WTA_K=2, int scoreType=ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold=20);
1.5 KeyPoint的数据结构

2、计算描述子DescriptorExtractor
2.1用法
Ptr<DescriptorExtractor> descriptor = ORB::create();
Mat descriptors_1;
descriptor->compute( img_1, keypoints_1,descriptors_1 );
//在descriptors_1中每一行roll储存一个对应的关键点的描述子
2.2数据结构


2.3其中子函数compute的数据结构


3、另一种方法:detectAndCompute函数
3.1用法

3.2数据结构

4、匹配DescriptorMatcher
4.1 用法
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create( "BruteForce-Hamming" );
vector<Dmatch> match;
matcher->match(descriptors_1, descriptors_2, match);
4.2DMatch的数据结构

调用方式:match.distance,可以与double类型的数据比较
4.3、DescriptorMatcher的数据结构(部分)
class CV_EXPORTS_W DescriptorMatcher : public Algorithm
{
public:
enum
{
FLANNBASED = 1,
BRUTEFORCE = 2,
BRUTEFORCE_L1 = 3,
BRUTEFORCE_HAMMING = 4,
BRUTEFORCE_HAMMINGLUT = 5,
BRUTEFORCE_SL2 = 6
};
5、匹配筛选
保留距离小于max(30.0,2*最小距离)的匹配
6、关于FeatureDetector与DescriptorExtractor的说明
FeatureDetector与DescriptorExtractor都是cv::Feature2D的别名,所以两者是相同的,以上分开使用是为了能体现特征提取描述子计算的步骤,第一二步可以用下面的代码来替代
cv::Ptr<cv::Feature2D> feature = cv::ORB::create();
feature->detect( img_1, keypoints_1 );
feature->compute( img_1, keypoints_1, descriptors_1);
本文详细介绍了视觉SLAM中OpenCV的特征匹配流程,包括特征提取、描述子计算、匹配方法及筛选策略。通过具体函数如ORB、SURF的使用,以及DescriptorMatcher的匹配过程,为读者提供了深入理解视觉SLAM特征匹配的技术指南。
17万+

被折叠的 条评论
为什么被折叠?



