Matlab function equivalent for Python (Flood Fill)

Quick question, I'm looking for a python function that does the equivalent job that matlab imfill.m does. I understand that python has openCV, but I could not get this to work correctly and am trying to find a replacement for it. The imfill part I'm trying to reproduce is the β€œholes”.

I have a mask that I generated, but I'm trying to fill in all the regions that are surrounded by β€œearth” and leave only empty areas of water.

If this is not clear enough, let me know and I can try to be more specific. Thank you for your time.

+4
source share
1 answer

I managed to find a function inside scipy that performed similarly to what imfill does. It is called binary_fill_holes and can be found here http://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.morphology.binary_fill_holes.html for those who have the same problem as me.

Although I can not take full / real credit for the search, as this question was answered in one of my other questions PIL Plus / imToolkit replacements from unutbu.

+4
source

All Articles