提取特征点和特征点描述

网上找的某段代码:

 //提取特征点    
    SurfFeatureDetector Detector(2000);  
    vector<KeyPoint> keyPoint1, keyPoint2;
    Detector.detect(image1, keyPoint1);
    Detector.detect(image2, keyPoint2);

    //特征点描述,为下边的特征点匹配做准备    
    SurfDescriptorExtractor Descriptor;
    Mat imageDesc1, imageDesc2;
    Descriptor.compute(image1, keyPoint1, imageDesc1);
    Descriptor.compute(image2, keyPoint2, imageDesc2);

在VS2019+opencv4.4.0的配置下会出错标红。
改为:

//提取特征点    
    Ptr<SurfFeatureDetector> Detector = SurfFeatureDetector::create();
    vector<KeyPoint> keyPoint1, keyPoint2;
    Detector->detect(image1, keyPoint1);
    Detector->detect(image2, keyPoint2);

    //特征点描述,为下边的特征点匹配做准备    
    Ptr<SurfDescriptorExtractor> Descriptor= SurfDescriptorExtractor::create();
    Mat imageDesc1, imageDesc2;
    Descriptor->compute(image1, keyPoint1, imageDesc1);
    Descriptor->compute(image2, keyPoint2, imageDesc2);

猜你喜欢

转载自blog.csdn.net/nobodyaha/article/details/109078412