2016-02-07 34 views
1

我试图在C++中使用OpenCV 3.1实现FAST功能检测/描述计算。源代码中没有实现OpenCV功能

我的代码:

Ptr<cv::FastFeatureDetector> fast = cv::FastFeatureDetector::create(); 
fast->detectAndCompute(img1, Mat(), keypoints1, desc); 

但是当我申请detectAndCompute,我得到一个错误。调试完毕后,我看到的源文件(features2d.cpp)在此必须抛出和错误:

//[In source file features2d.cpp] 
/* Detects keypoints and computes the descriptors */ 
    void Feature2D::detectAndCompute(InputArray, InputArray, 
             std::vector<KeyPoint>&, 
             OutputArray, 
             bool) 
    { 
     CV_Error(Error::StsNotImplemented, ""); 
    } 

这是为什么没有实现?还有另一种方法让我使用FAST?

回答

4

你也可以在openCV中创建一个特征检测器通用指针并使用它。

cv::Ptr<cv::FeatureDetector> detectorPFast= FeatureDetector::create("PyramidFAST"); 
    std::vector<KeyPoint> keypointsPFast1; 
    detectorPFast->detect(src, keypointsPFast1); 
2

FAST只是一个特征检测器,并且没有要计算的描述符。所以,你只需要调用:

fast->detect(img1, keypoints1); 
+0

谢谢!你知道我可以使用的快速特征描述符吗? – black

+0

要快,你应该使用二进制描述符,如ORB,FREAK等... – Miki