opencv3中SurfFeatureDetector、SurfDescriptorExtractor、BruteForceMatcher的使用 opencv2中SurfFeatureDetector
2017-11-29 14:24
1431 查看
opencv3中SurfFeatureDetector、SurfDescriptorExtractor、BruteForceMatcher的使用
opencv2中SurfFeatureDetector、SurfDescriptorExtractor、BruteForceMatcher在opencv3中发生了改变。具体如何完成特征点匹配呢?示例如下:
//寻找关键点
int minHessian = 700;
Ptr<SURF>detector = SURF::create(minHessian);
detector->detect( srcImage1, keyPoint1 );
detector->detect( srcImage2, keyPoints2 );
//绘制特征关键点
Mat img_keypoints_1; Mat img_keypoints_2;
drawKeypoints( srcImage1, keypoints_1, img_keypoints_1, Scalar::all(-1), DrawMatchesFlags::DEFAULT );
drawKeypoints( srcImage2, keypoints_2, img_keypoints_2, Scalar::all(-1), DrawMatchesFlags::DEFAULT );
//显示效果图
imshow("特征点检测效果图1", img_keypoints_1 );
imshow("特征点检测效果图2", img_keypoints_2 );
//计算特征向量
Ptr<SURF>extractor = SURF::create();
Mat descriptors1, descriptors2;
extractor->compute( srcImage1, keyPoint1, descriptors1 );
extractor->compute( srcImage2, keyPoints2, descriptors2 );
//使用BruteForce进行匹配
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create("BruteForce");
std::vector< DMatch > matches;
matcher->match( descriptors1, descriptors2, matches );
//绘制从两个图像中匹配出的关键点
Mat imgMatches;
drawMatches( srcImage1, keyPoint1, srcImage2, keyPoints2, matches, imgMatches );//进行绘制
//显示
imshow("匹配图", imgMatches );
3.x的特征检测:
算法:SURF,SIFT,BRIEF,FREAK
类:cv::xfeatures2d::SURF
cv::xfeatures2d::SIFT
cv::xfeatures::BriefDescriptorExtractor
cv::xfeatures2d::FREAK
cv::xfeatures2d::StarDetector
需要进行以下几步
加入opencv_contrib
包含opencv2/xfeatures2d.hpp
using namepsace cv::xfeatures2d
使用create(),detect(),compute(),detectAndCompute()
opencv2中SurfFeatureDetector、SurfDescriptorExtractor、BruteForceMatcher在opencv3中发生了改变。具体如何完成特征点匹配呢?示例如下:
//寻找关键点
int minHessian = 700;
Ptr<SURF>detector = SURF::create(minHessian);
detector->detect( srcImage1, keyPoint1 );
detector->detect( srcImage2, keyPoints2 );
//绘制特征关键点
Mat img_keypoints_1; Mat img_keypoints_2;
drawKeypoints( srcImage1, keypoints_1, img_keypoints_1, Scalar::all(-1), DrawMatchesFlags::DEFAULT );
drawKeypoints( srcImage2, keypoints_2, img_keypoints_2, Scalar::all(-1), DrawMatchesFlags::DEFAULT );
//显示效果图
imshow("特征点检测效果图1", img_keypoints_1 );
imshow("特征点检测效果图2", img_keypoints_2 );
//计算特征向量
Ptr<SURF>extractor = SURF::create();
Mat descriptors1, descriptors2;
extractor->compute( srcImage1, keyPoint1, descriptors1 );
extractor->compute( srcImage2, keyPoints2, descriptors2 );
//使用BruteForce进行匹配
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create("BruteForce");
std::vector< DMatch > matches;
matcher->match( descriptors1, descriptors2, matches );
//绘制从两个图像中匹配出的关键点
Mat imgMatches;
drawMatches( srcImage1, keyPoint1, srcImage2, keyPoints2, matches, imgMatches );//进行绘制
//显示
imshow("匹配图", imgMatches );
3.x的特征检测:
算法:SURF,SIFT,BRIEF,FREAK
类:cv::xfeatures2d::SURF
cv::xfeatures2d::SIFT
cv::xfeatures::BriefDescriptorExtractor
cv::xfeatures2d::FREAK
cv::xfeatures2d::StarDetector
需要进行以下几步
加入opencv_contrib
包含opencv2/xfeatures2d.hpp
using namepsace cv::xfeatures2d
使用create(),detect(),compute(),detectAndCompute()
相关文章推荐
- SURF特征点检测--SurfFeatureDetector、SurfDescriptorExtractor和FlannBasedMatcher
- opencv3.2中SurfFeatureDetector、SurfDescriptorExtractor、BruteForceMatcher用法
- OpenCV - undefined reference: SurfFeatureDetector and BruteForceMatcher
- VS2012提示cv中没有成员SurfFeatureDetector/SiftFeatureDetector/BruteForceMatcher
- 【cv】使用opencv的FeatureDetector,DescriptorExtractor,DescriptorMatcher
- OrbFeatureDetector, OrbDescriptorExtractor, SVM 报错问题
- OpenCV中SurfDescriptorExtractor
- OpenCV使用之-----BruteForceMatcher无法使用
- OpenCV中BriefDescriptorExtractor
- OpenCV各个detector/descriptor/matcher的创建和使用
- opencv “未声明的标识符:SurfFeatureDetector”问题解决办法
- 【错误处理】error C2065: “SurfFeatureDetector”: 未声明的标识符;error C2065: “FlannBasedMatcher”: 未声明的标识符
- 文档源代码opencv 中的错误error: ‘SurfFeatureDetector’ was not declared in this scope
- OpenCV中feature2D学习——ORB和BruteForceMatcher
- OPENCV中BFMatcher(BruteForceMatcher)和FlannBasedMatcher区别
- opencv 中的错误error: ‘SurfFeatureDetector’ was not declared in this scope
- opencv中SiftDescriptorExtractor所做的SIFT特征向量提取工作简单分析
- opencv中SiftDescriptorExtractor所做的SIFT特征向量提取工作简单分析
- opencv2.4.5正确调用SurfFeatureDetector,SiftFeatureDetector
- opencv中SiftDescriptorExtractor所做的SIFT特征向量提取工作简单分析