Calculate the distance L, distance H and circumference (boundary)

1 次查看(过去 30 天)
How can I write code to calculate the distance L; the longest horizontal way, distance H; the highest vertical and circumference (boundary), distance B in Figure A1.jpg that is white in matlab?
A1.jpg

采纳的回答

Image Analyst
Image Analyst 2020-1-4
Try this:
binaryImage = bwareafilt(binaryImage, 1); % Extract largest blob only.
props = regionprops(binaryImage, 'BoundingBox', 'Perimeter');
width = props.BoundingBox(3); % Horizontal distance.
height = props.BoundingBox(4); % Vertical distance.
perimeter = props.Perimeter;

更多回答(0 个)

产品


版本

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by