OpenCV3 角点检测

OpenCV3中,角点检测的几个方法(SURF,SIFT,ORB)都被转移到opencv_contrib中了,需要自己编译。

这些算法都在xfeatures2d库中,#include<opencv2\xfeatures2d.hpp>。

转移前的写法:

cv::SurfFeatureDetector surf(15);
vector<KeyPoint> key_points;
surf.detect(img, key_points);

新写法:

    Ptr<FeatureDetector> surf = SurfFeatureDetector::create(200);
    vector<KeyPoint> key_points;
    surf->detect(src, key_points);      // 检测src图像中的SURF特征

推荐如下写法:不用检测器

    // SURF特征检测
    Ptr<SURF> surf = SURF::create(minHessian);
    vector<KeyPoint> key_points;
    surf->detect(src, key_points);      // 检测src图像中的SURF特征

猜你喜欢

转载自www.cnblogs.com/xixixing/p/12299677.html