I have a contours of a binary image, I get the largest object, and I want select all out this object to paint it. I have this code:
vector<vector<Point> > contours;
findContours( img.clone(), contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
vector<Rect> boundSheet( contours.size() );
int largest_area=0;
for( int i = 0; i< contours.size(); i++ )
{
double a= contourArea( contours[i],false);
if(a>largest_area){
largest_area=a;
boundSheet[i] = boundingRect(contours[i]);
}
}
I want to paint everything outside the boundary with drawContours
, how can I select all out contour?