1 | initial version |
I believe findContours treads white as foreground and black as background:
The pointer first_contour is filled by the function. It will contain a pointer to the first outermost contour or NULL if no contours are detected (if the image is completely black)
So for findContours your image is a big white rectangle with a black hole in it.
You could negate the image first, otherwise I think you will have to discard the biggest contour.
2 | No.2 Revision |
I believe findContours treads white as foreground and black as background:
The pointer first_contour is filled by the function. It will contain a pointer to the first outermost contour or NULL if no contours are detected (if the image is completely black)
So for findContours your image is a big white rectangle with a black hole in it.
You could negate the image first, first; otherwise I think you will have to discard the biggest contour.