1 | initial version |
The following code snippet works here
// This vector contains your original data
// The second one will contain the selected ones
vector<Rect> contours, filtered;
// Now apply the thresholding
for(size_t i=0; i<contours.size(); i++){
double area = contourArea(contours[i]);
if( (area < 65.0) || (area > 1000.0) ){
filtered.push_back(contours[i]);
}
}
My guess is that your are incorrectly using the erase function.
2 | No.2 Revision |
The following code snippet works here
// This vector contains your original data
// The second one will contain the selected ones
vector<Rect> contours, filtered;
// Now apply the thresholding
for(size_t i=0; i<contours.size(); i++){
double area = contourArea(contours[i]);
if( if( (area > 65.0) && (area < 65.0) || (area > 1000.0) 1000.0)) ){
filtered.push_back(contours[i]);
}
}
My guess is that your are incorrectly using the erase function.