MATLAB detecting the largest open space in a binary image

조회 수: 3 (최근 30일)
Kanthi
Kanthi 2014년 9월 22일
댓글: Kanthi 2014년 9월 23일
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.

채택된 답변

Image Analyst
Image Analyst 2014년 9월 22일
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
Image Analyst
Image Analyst 2014년 9월 23일
Can you go ahead and mark my answer as "Accepted" then? Thanks.
Kanthi
Kanthi 2014년 9월 23일
I just did. Please let me know if I need to do anything else. Again...thanks for all your help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by