Python Forum
Equivalent of 'bwareafilt' for Python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Equivalent of 'bwareafilt' for Python (/thread-24245.html)



Equivalent of 'bwareafilt' for Python - Mighty - Feb-05-2020

What is an equivalent to the MATLAB function bwareafilt in Python? I need an output binary image that only contains the largest connected area of pixels.


RE: Equivalent of 'bwareafilt' for Python - Marbelous - Feb-05-2020

I'm not familiar with MatLab but it sounds like a blob analysis. I didn't find anything in PIL (or PILLOW) that does that although you could probably use its functions to make something similar.

Looks like there are similar tools in OpenCV you could use though:
https://stackoverflow.com/questions/2348365/matlab-bwareaopen-equivalent-function-in-opencv
https://makehardware.com/2016/05/19/blob-detection-with-python-and-opencv/