1 | initial version |
you're drawing your contours 2 x , the first time all of them, the next only the big ones.
just remove (or comment) the first loop:
// not needed:
for(int i = 0; i < contours.size(); i++)
{
Scalar color = Scalar(255,255,255);
drawContours( drawing, contours_poly, i, color, 1, 8, vector<Vec4i>(), 0, Point() );
fillPoly(drawing, contours, Scalar(255,0,0));
}
2 | No.2 Revision |
you're drawing your contours 2 x , the first time all of them, the next only the big ones.
just remove (or comment) the first loop:
// not needed:
for(int //for(int i = 0; i < contours.size(); i++)
{
//{
// Scalar color = Scalar(255,255,255);
// drawContours( drawing, contours_poly, i, color, 1, 8, vector<Vec4i>(), 0, Point() );
// fillPoly(drawing, contours, Scalar(255,0,0));
}
//}
and draw the poly int the second loop:
3 | No.3 Revision |
you're drawing your contours 2 x , the first time all of them, the next only the big ones.
just remove (or comment) the first loop:
// not needed:
//for(int i = 0; i < contours.size(); i++)
//{
// Scalar color = Scalar(255,255,255);
// drawContours( drawing, contours_poly, i, color, 1, 8, vector<Vec4i>(), 0, Point() );
// fillPoly(drawing, contours, Scalar(255,0,0));
//}
and draw the poly int the second loop: