[英]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 我正在使用opencv 2.2和VC ++(2008)来跟踪对象,同时在程序“ 向量迭代器不兼容 ”中使用goodFeaturesToTrack时发生错误
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 . goodFeaturesToTrack根据文档接受tempimage的附加参数。 Its first 3 arguments are of type CvArr, which a
std::vector<cv::Point2f>
isn't , hence difference in std::vector
iterators error message. 它的前3个参数的类型为CvArr,而不是
std::vector<cv::Point2f>
,因此std::vector
迭代器错误消息有所不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.