struct contour_sorter // 'less' for contours
{
bool operator ()(const vector<Point> &a,const vector<Point> &b )
{
Rect ra(boundingRect(a));
Rect rb(boundingRect(b));
// scale factor for y should be larger than img.width
return ( (ra.x + 1000*ra.y) < (rb.x + 1000*rb.y) );
}
};
vector<Point> requiredPoints;
unique(requiredPoints.begin(), requiredPoints.end() );
// apply it to the contours:
std::sort(requiredPoints.begin(), requiredPoints.end(), contour_sorter());
错误是:
没有已知的从'cv :: Point_'到'const的参数1的转换 std :: vector&gt;&amp;'
有没有更好的方法来实现我的目标?我只想检测物体,将每个物体放在一个矩形中,找到相机的距离。现在我只是从形态操作中得到了斑点。谢谢
可以通过链接查看图像