博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
OpenCV中feature2D——BFMatcher和FlannBasedMatcher
阅读量:4551 次
发布时间:2019-06-08

本文共 2337 字,大约阅读时间需要 7 分钟。

作者:holybin 

原文:https://blog.csdn.net/holybin/article/details/40926315 

 

Brute Force匹配和FLANN匹配是opencv二维特征点匹配常见的两种办法,分别对应BFMatcher(BruteForceMatcher)和FlannBasedMatcher。BFMatcher的构造函数如下:

C++: BFMatcher::BFMatcher(int normType=NORM_L2, bool crossCheck=false )

Parameters:

  • normType – One of NORM_L1NORM_L2NORM_HAMMINGNORM_HAMMING2L1 and L2 norms are preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor description).

  • crossCheck – If it is false, this is will be default BFMatcher behaviour when it finds the k nearest neighbors for each query descriptor. If crossCheck==true, then the knnMatch() method with k=1 will only return pairs (i,j) such that for i-th query descriptor the j-th descriptor in the matcher’s collection is the nearest and vice versa, i.e. the BFMatcher will only return consistent pairs. Such technique usually produces best results with minimal number of outliers when there are enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.

 

FlannBasedMatcher的构造函数如下:

class FlannBasedMatcher : public DescriptorMatcher{public:    FlannBasedMatcher(      const Ptr
& indexParams=new flann::KDTreeIndexParams(), const Ptr
& searchParams=new flann::SearchParams() ); virtual void add( const vector
& descriptors ); virtual void clear(); virtual void train(); virtual bool isMaskSupported() const; virtual Ptr
clone( bool emptyTrainData=false ) const;protected: ...};

 

二者的区别在于BFMatcher总是尝试所有可能的匹配,从而使得它总能够找到最佳匹配,这也是Brute Force(暴力法)的原始含义。而FlannBasedMatcher中FLANN的含义是Fast Library forApproximate Nearest Neighbors,从字面意思可知它是一种近似法,算法更快但是找到的是最近邻近似匹配,所以当我们需要找到一个相对好的匹配但是不需要最佳匹配的时候往往使用FlannBasedMatcher。当然也可以通过调整FlannBasedMatcher的参数来提高匹配的精度或者提高算法速度,但是相应地算法速度或者算法精度会受到影响。

此外,使用特征提取过程得到的特征描述符(descriptor)数据类型有的是float类型的,比如说SurfDescriptorExtractor,

SiftDescriptorExtractor,有的是uchar类型的,比如说有ORB,BriefDescriptorExtractor。对应float类型的匹配方式有:FlannBasedMatcher,BruteForce<L2<float>>,BruteForce<SL2<float>>,BruteForce<L1<float>>。对应uchar类型的匹配方式有:BruteForce<Hammin>,BruteForce<HammingLUT>。所以ORB和BRIEF特征描述子只能使用BruteForce匹配法。

转载于:https://www.cnblogs.com/gdut-gordon/p/9993224.html

你可能感兴趣的文章
luogu1972:HH的项链
查看>>
矩形面积
查看>>
C++语言 文件对话框的调用
查看>>
运算符
查看>>
11.软件项目管理与敏捷方法——风险管理笔记
查看>>
微服务监控zipkin、skywalking以及日志ELK监控系列
查看>>
4553: [Tjoi2016&Heoi2016]序列
查看>>
3027 线段覆盖 2
查看>>
CF 959 E. Mahmoud and Ehab and the xor-MST
查看>>
【niubi-job——一个分布式的任务调度框架】----niubi-job这下更牛逼了!
查看>>
移动支付[1]——MAC加密
查看>>
c++深/浅拷贝 && 构造函数析构函数调用顺序练习题
查看>>
java读取文件夹下所有文件并替换文件每一行中指定的字符串
查看>>
HTML5规范-相关资料链接(大多都是英文文档)
查看>>
[转]OData/WebApi
查看>>
[转]高颜值、好用、易扩展的微信小程序 UI 库,Powered by 有赞
查看>>
[转]SQL Server如何启用xp_cmdshell组件
查看>>
[转]微擎应用笔记3--manifest.xml文件使用说明
查看>>
Codeforces 1000C Covered Points Count 【前缀和优化】
查看>>
python高效读取文件、文件改写
查看>>