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
2 | No.2 Revision |
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();idBiggetsidBiggest = i; } } // contours[ idBiggest ] should be the one you want