在OpenCV中繪製單個輪廓的最佳方式是什麼?據我所見drawContours只能處理多個輪廓。在OpenCV中繪製單個輪廓在圖像上
背景:我想將我的代碼更改爲每個循環。舊代碼:
//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);
}
}
有畫單輪廓(矢量<點>對象)一個更清潔的方式?
我只是想畫的輪廓,即滿足某些屬性。這就是迭代的原因。 –