2012-11-21 29 views
0

上使用FeatureDetector的第二個變體,我能夠成功將多個圖像加載到矢量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

detect簽名中,keypoints應該是vector<vector<KeyPoint>>,但您聲明它爲vector<KeyPoint>

+0

謝謝。我怎麼會想念那個 – ipunished