【OpenCV】SURF特征点提取与匹配中opencv2向opencv3移植问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hongtao_6/article/details/82185796

注意:opencv3中使用SURF特征点提取需要编译contrib,请自行参考我的另一片博文:3.4.0图像拼接Stitching模块介绍

首先是包含头文件的不同

#include <opencv2\nonfree\nonfree.hpp>//OpenCV2 中的头文件
#include <opencv2\xfeatures2d\nonfree.hpp>//OpenCV3 中的头文件

detect与compute函数的不同

    //提取特征点    
    SurfFeatureDetector Detector(2000);//OpenCV2 中的写法
    Ptr<xfeatures2d::SURF> Detector = xfeatures2d::SURF::create(2000);//OpenCV3 中的写法
    Detector.detect(image1, keyPoint1);//OpenCV2 中的写法
    Detector->detect(image1, keyPoint1);//OpenCV3 中的写法

    //特征点描述 
    SurfDescriptorExtractor Descriptor;//OpenCV2 中的写法
    Ptr<xfeatures2d::SURF> Descriptor = xfeatures2d::SURF::create();//OpenCV3 中的写法
    Descriptor.compute(image1, keyPoint1, imageDesc1);//OpenCV2 中的写法
    Descriptor->compute(image1, keyPoint1, imageDesc1);//OpenCV3 中的写法

猜你喜欢

转载自blog.csdn.net/hongtao_6/article/details/82185796