我正在尝试在C++中使用OpenCV 3.1实现FAST特征检测/描述计算。
我的代码:
Ptr<cv::FastFeatureDetector> fast = cv::FastFeatureDetector::create();
fast->detectAndCompute(img1, Mat(), keypoints1, desc);
但是当我应用检测和计算时,我得到一个错误。调试后,我看到在源文件(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?
您还可以在 openCV 中创建特征检测器通用指针并使用它。
cv::Ptr<cv::FeatureDetector> detectorPFast= FeatureDetector::create("PyramidFAST");
std::vector<KeyPoint> keypointsPFast1;
detectorPFast->detect( src, keypointsPFast1 );
FAST 只是一个特征检测器,没有要计算的描述符。因此,您只需要调用:
fast->detect(img1, keypoints1);