我能够成功地将多个图像加载到矢量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);
答案 0 :(得分:1)
从detect
签名,keypoints
应为vector<vector<KeyPoint>>
,但您将其声明为vector<KeyPoint>
。