1 | initial version |
if there are no contours found, you cannot index the (empty) contours array.
check your largest_area
value, and only execute the drawing code, if it's != 0
2 | No.2 Revision |
if there are no contours found, you cannot index the (empty) contours array.
check your largest_area
value, and only execute the drawing code, if it's != 0
also make sure, you initialize those variables per image, like:
int largest_area = 0; int largest_contour_index = 0; Rect bounding_rect;
3 | No.3 Revision |
if there are no contours found, you cannot index the (empty) contours array.
check your largest_area
value, and only execute the drawing code, if it's != 0
also make sure, you initialize those variables per image, like:
for (size_t i = 0; i < files.size(); i++) {
int largest_area = 0;
int largest_contour_index = 0;
Rect