【发布时间】:2014-03-20 04:01:48
【问题描述】:
在 OpenCV 中绘制单个轮廓的最佳方法是什么?据我所知drawContours 只能处理多个轮廓。
背景:我想将我的代码更改为 for each 循环。旧代码:
//vector<vector<Point> > contours = result of findContours(...)
for (int i = 0; i < contour.size; i++){
if(iscorrect(contours[i])){
drawContours(img, contours, i, color, 1, 8, hierarchy);
}
}
in this mailing list 的呈现方式很丑:
for (vector<Point> contour : contours){
if(iscorrect(contour)){
vector<vector<Point> > con = vector<vector<Point> >(1, contour);
drawContours(img, con, -1, color, 1, 8);
}
}
有没有更简洁的方法来绘制单个轮廓(向量
【问题讨论】: