[OpenCV] Feature Matching

得到了杂乱无章的特征点后,要筛选出好的特征点,也就是good matches.


 

BruteForceMatcher

FlannBasedMatcher

两者的区别:http://yangshen998.iteye.com/blog/1311575

flann的含义:http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.html

 

在FLANN特征匹配的基础上,还可以进一步利用Homography映射找出已知物体。

具体来说就是利用findHomography函数利用匹配的关键点找出相应的变换,再利用perspectiveTransform函数映射点群。

Mat H = findHomography( obj, scene, CV_RANSAC );  // 获得了变换 Matrix

 

 


From: http://blog.sina.com.cn/s/blog_821b37de0102uzwb.html

OpenCV里有很多的feature,建立和使用方法也比较杂,现在整理一下避免以后用到。

1、detector 

统一的定义方式:
Ptr  detector = FeatureDetector::create("STAR");
"FAST" – FastFeatureDetector
"STAR" – StarFeatureDetector
"SIFT" – SIFT (nonfree module)
"SURF" – SURF (nonfree module)
"ORB" – ORB
"BRISK" – BRISK
"MSER" – MSER
"GFTT" – GoodFeaturesToTrackDetector
"HARRIS" – GoodFeaturesToTrackDetector with Harris detector enabled
"Dense" – DenseFeatureDetector
"SimpleBlob" – SimpleBlobDetector
 
除了统一定义方式之外,有的可以用它自己的feature名字定义,比如
SurfFeatureDetector detector;
SiftFeatureDetector detector;
FastFeatureDetector detector;
STARFeatureDetector detector;
 
还有一种统一定义方式:
cv::Ptr  detector2 = cv::Algorithm::create("BRISK");
其中cv::可以去掉。
动态的特征点定义方式:
Ptr detector =
            new DynamicAdaptedFeatureDetector(
            AdjusterAdapter::create("SURF"), 100, 500, 5);
 

2、Descriptorextractor

统一定义方式:  Ptr extractor=DescriptorExtractor::create("SURF");
"SIFT" – SIFT
"SURF" – SURF
"BRIEF" – BriefDescriptorExtractor
"BRISK" – BRISK
"ORB" – ORB
"FREAK" – FREAK
 
个别定义方式:Ptr extractor=new SiftDescriptorExtractor;
Ptr extractor =new SurfDescriptorExtractor;
Ptr extractor =new BriefDescriptorExtractor;
其他定义方式:
 SurfDescriptorExtractor extractor;
SiftDescriptorExtractor extractor;
BriefDescriptorExtractor extractor;
其他的一些特征可以直接定义对象并用来detect和extract特征
比方说 BRISK  BRISKD(60,4,1.0f);
   BRISKD.create("BRISK");
   BRISKD.detect(object,kp_object);
   BRISKD.compute(object,kp_object,des_object);
 

3、matcher

统一定义方式 Ptr matcher = DescriptorMatcher::create("FlannBased");
BruteForce (it uses L2 )
BruteForce-L1
BruteForce-Hamming
BruteForce-Hamming(2)
FlannBased
 
其他定义方式:
BFMatcher matcher(type);
normType – One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. L1 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).
FlannBasedMatcher matcher;
 
posted @ 2016-09-30 13:10  郝壹贰叁  阅读(1932)  评论(0编辑  收藏  举报