MATLAB: How to find the pixels of certain regions in a binary image

area of a regionedge detectionimage processing

I have created a binary image which contains the edges of an image. I want to keep only the pixels of the regions that have an area bigger than 250 pixels. How can I do that?

Best Answer

You might want to use the 'bwselect' function to select objects in a binary image. You can use this with the 'bwarea' function which calculates the area of objects in a binary image. You might want to refer to the following documentation links:
https://www.mathworks.com/help/images/labeling-and-measuring-objects-in-a-binary-image.html
https://www.mathworks.com/help/images/ref/bwselect.html
https://www.mathworks.com/help/images/ref/bwarea.html