Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Run the ConnectedComponentsWithStats function on the image. Get the smallest surfaces, as zones to merge.

Then, for each black pixel: check its neighbors (on the connected components image); if it contains a component to merge AND another component, then set it to white.