Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

When you find contours, you only find the boundaries, and each boundary is a separate contour. So when you eliminate the small ones, you eliminate the small contours inside the large one. You either need to explicitly keep all contours that are inside the large one (use the hierarchy output variable), or use connected components instead.

Connected Components might be closer to what you want. It finds all the blobs of white pixels. You simply filter the ones that have too small an area, and it keeps both the inner and outer boundaries.

Which one is best depends on what exactly you're doing with them, but both should work.