MATLAB: How to find the largest region in binary image and replace all other region with black

digital image processingImage Processing Toolboximage segmentationregion extraction

I have a binary image (attached as 'randomm.jpg') that consists of several shapes.
How to extract the shape with most pixels (white) and replace other figures with black?
Thank you!

Best Answer