1 | initial version |
Looks like you should apply dilate
, erode
, erode
, dilate
to clean up the image. Then, you can use findcontours
and eliminate contours with "small" area as well as any contours that touch the image borders. You may have to experiment a bit with the first part.