How can I determine the area of the individual objects in my logical image within the Image Processing Toolbox 3.2 (R13)?

7 views (last 30 days)
I am trying to determine the areas for each of the objects in my logical image. I have tried using the BWAREA function, but it returns the total area of all objects in the image, not the area of each object.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
You can determine the area for individual objects by using a combination of the BWLABEL and REGIONPROPS functions.
First, you should use the BWLABEL function to return a label matrix. Each object in your original image will be assigned a different label value in the corresponding positions in the label matrix. For example, all positions with the value 1 in the label matrix correspond to a single object in your original image, all positions with the value 2 correspond to another object, etc. :
L_image = bwlabel(original_image);
After obtaining the label matrix, you can use the REGIONPROPS function to determine the area for each of the objects in the label matrix:
A = regionprops(L_image,'Area');

More Answers (0)

Community Treasure Hunt

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

Start Hunting!