MATLAB: Displaying area of each labeled region

imageimage processing

I would like to display area for each labeled region in the generated result image, after binarize and labeling gray-scale image. This is part of the codes:
hold on;
Measurements = regionprops(labImg, fgImg, 'all');
numberOfBlobs = size(Measurements, 1);
for k = 1:numberOfBlobs
areas=Measurements(k).Area;
plot(areas(:,2), areas(:,1), 2);
end
hold off;
Besides that, is there any idea to display labeled no. and area of labeled image in orders in command window?

Best Answer

You should be able to use this outside of a loop:
blobareas = [Measurements.Area];
printf('%3d: %5d\n', [1 : length(blobareas); blobareas]);
Note: the Area field returned by regionprops() will always be a scalar, so accessing the second column of it like you do in areas(:,2) will cause an error.