(文章借鉴《OpenCV3编程入门》)
SURF特征点提取(图像为灰度图)
一,BruteForce进行特征点匹配
【1】使用SURF算子检测关键点
int minHessian = 700;//SURF算法中的hessian阈值SurfFeatureDetector detector(minHessian);//定义一个SurfFeatureDetector(SURF) 特征检测类对象
vector<KeyPoint> keyPoint1, keyPoints2;//vector模板类,存放任意类型的动态数组
【2】调用detect函数检测出SURF特征关键点,保存在vector容器中
detector.detect(srcImage1, keyPoint1);
detector.detect(srcImage2, keyPoints2);
【3】计算描述符(特征向量)
SurfDescriptorExtractor extractor;
Mat descriptors1, descriptors2;
extractor.compute(srcImage1, keyPoint1, descriptors1);
extractor.compute(srcImage2, keyPoints2, descriptors2);
【4】使用BruteForce进行匹配
// 实例化一个匹配器
BruteForceMatcher< L2&l