Opencv peripheral contour polygon extraction or delete the smallest maximum profile

std::vector resultpoly; cv :: approxPolyDP (contours [0], resultpoly, 4, true); // profile contours [0], resultpoly point of the polygon set cv :: polylines (src, resultpoly, true, 150, 1); // polygon drawing outer contour cv :: imshow ( "detected polyLines", src); // display polygonal outer contour Links https://www.cnblogs.com/donaldlee2008/p/5230032.html // // removed too small or too large outline void getSizeContours (vector > & Contours) {int cmin = 100; // minimum profile length int cmax = 1000; // maximum profile length vector >::const_iterator itc = contours.begin(); while(itc != contours.end()) { if((itc->size()) < cmin || (itc->size()) > cmax) { itc = contours.erase(itc); } else ++ itc; } }

Guess you like

Origin www.cnblogs.com/rjjhyj/p/11479899.html