在图像集上使用FeatureDetector的第二个变体

时间:2012-11-21 23:31:43

标签: opencv sift feature-detection

我能够成功地将多个图像加载到矢量vector<Mat>中。加载后的图像可以使用imread功能显示。

问题在于我想使用第二种变体在这组图像上应用SIFT,如文档中所述:

void FeatureDetector::detect(const vector<Mat>& images, vector<vector<KeyPoint>>& keypoints, const vector<Mat>& masks=vector<Mat>() ) const

这会产生以下错误:

error C2664: 'void cv::FeatureDetector::detect(const cv::Mat &,std::vector<_Ty> &,const cv::Mat &) const' : cannot convert parameter 1 from 'std::vector<_Ty>' to 'const cv::Mat &'

我正在使用的代码:

vector<Mat> images;

/* code to add all images to vector not shown as its messy but it was performed with FindFirstFile of windows.h. All images loaded correctly as they can be read by imread*/

initModule_nonfree();

Ptr<FeatureDetector> get_keypoints = FeatureDetector::create("SIFT");
vector<KeyPoint> keypoints;
get_keypoints->detect(images , keypoints);

get_keypoints->detect(images , keypoints);

处检测到错误

1 个答案:

答案 0 :(得分:1)

detect签名,keypoints应为vector<vector<KeyPoint>>,但您将其声明为vector<KeyPoint>