开发者

opencv "vector iterators incompatible"

开发者 https://www.devze.com 2023-03-15 07:31 出处:网络
I am using opencv 2.2 and VC++(2008) to track an object, whileusing goodFeaturesToTrack in the program \'vector iterators incompatible\' error occurs

I am using opencv 2.2 and VC++(2008) to track an object, while using goodFeaturesToTrack in the program 'vector iterators incompatible' error occurs

开发者_StackOverflow中文版
vector<Point2f> points;
goodFeaturesToTrack(mat,points,10, 0.01, 10, Mat(), 3, 0, 0.04);

Is there any work around for this?


Try the following instead.

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 takes an additional argument of tempimage as per the documentation. Its first 3 arguments are of type CvArr, which a std::vector<cv::Point2f> isn't , hence difference in std::vector iterators error message.

0

精彩评论

暂无评论...
验证码 换一张
取 消