www.gusucode.com > images 案例代码 matlab源码程序 > images/ComputeTheAreaOfObjectsInABinaryImageExample.m

    %% Calculate the Area of Objects in a Binary Image
% 
%%
% Read the image and display it.

% Copyright 2015 The MathWorks, Inc.

BW = imread('circles.png');
imshow(BW);
%%
% Calculate the area of objects in the image.
bwarea(BW)