0

我能够成功地将许多图像加载到一个向量中,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);

4

1 回答 1

1

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

于 2012-11-22T15:43:44.600 回答