MATLAB detecting the largest open space in a binary image
2 views (last 30 days)
Show older comments
I am trying to obtain the area of the largest open (black) space (non-contiguous) in a binary image. The actual binary image is shown in "Original_Image.png" attachment. What I am looking for is the area of the region roughly bounded by the red line in the "Original_Image_red.png". Thanks for your help.
0 Comments
Accepted Answer
Image Analyst
on 22 Sep 2014
You didn't attach the image. But the steps are (untested)
% Call bwlabel or bwconncomp on the inverted image.
cc = bwconncomp(~binaryImage);
% Measure the area of all the blobs.
measurements = regionprops(cc, 'Area');
allAreas = [measurements.Area]
% Find the biggest area and blob number
[maxArea, indexOfBiggestBlob] = max(allAreas);
8 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!