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.
精彩评论