Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

so, you get several contours there, i'd just take the largest one ( the one with the most points ), and skip all the others.

int numBiggest = 0;
int idBiggest = -1;
for( int i = 0; i < contours.size(); i++ ) { 
    if ( contours[i].size() >  numBiggest ) {
        numBiggest = contours[i].size();
        idBiggets = i;
    }
}

// contours[ idBiggest ] should be the one you want

so, you get several contours there, i'd just take the largest one ( the one with the most points ), and skip all the others.

int numBiggest = 0;
int idBiggest = -1;
0;
for( int i = 0; i < contours.size(); i++ ) { 
    if ( contours[i].size() >  numBiggest ) {
        numBiggest = contours[i].size();
        idBiggets idBiggest = i;
    }
}

// contours[ idBiggest ] should be the one you want