MATLAB: How to calculate the height and area of ​​the object in the picture

height area calculateImage Processing Toolbox

Isb = rgb2gray(I)
Isbort = mean (Isb(:));
Isbort=mean(Isb(:))
Isbm=median(Isb(:))
Isbs=std(double(Isb(:)))
imshow(Isb);
J=Isb>105;
J=im2double(J);
M = rot90(J)
imshow(M)

Best Answer

Use regionprops() to get the bounding box. You'll know how to do that if you go over my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
Then use the attached demo to get the numbers in real world units (cm) instead of pixels.