Assuming you have a good binary image, you do this
measurements = regionprops(logical(binaryImage), 'Area');
allAreas = [measurements.Area];
DON'T USE IMAGE AS THE NAME OF YOUR VARIABLE. It's a built in function and you will overwrite it if you do that. It's never a good idea to use the names of functions or keywords as variable names. I probably wouldn't do it the same way as you but it depend on what your image looks like. For example, I wouldn't burn the perimeter into the image like you're doing - I'd use bwboundaries() and just display the boundaries in the overlay above the image. I'd maybe change some other things too, but whatever, if it works, then fine.
Best Answer