2011-06-24 33 views
1

我使用的OpenCV 2.2和VC++(2008)跟蹤對象,而在程序中使用goodFeaturesToTrack「矢量迭代器不相容」發生錯誤OpenCV的「載體迭代不相容」

vector<Point2f> points; 
goodFeaturesToTrack(mat,points,10, 0.01, 10, Mat(), 3, 0, 0.04); 

是否有任何工作爲了這個?

回答

0

請改爲嘗試以下操作。

std::vector<cv::Point2f> points; 
cv::Mat pointmat(points); 
cv::Mat tempmat = Mat(mat.rows,mat.cols, cv::CV_32FC1); 
goodFeaturesToTrack(mat,pointmat, tempmat,10, 0.01, 10, Mat(), 3, 0, 0.04); 

goodFeaturesToTrack根據documentation採用tempimage的附加參數。它的前3個參數的類型是CvArr,其中std::vector<cv::Point2f>不是,因此std::vector迭代器錯誤消息的差異。