开发者

opencv "vector iterators incompatible"

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜