How to calculate Area ??
5 次查看(过去 30 天)
显示 更早的评论
Hey every body....
I am asking "how can i compute area of the bounding box and convex hull where i had already get it's parameters?"
Thank you
2 个评论
Walter Roberson
2013-6-13
When you say "already get it's parameters", could you be more specific about what information you already have?
采纳的回答
the cyclist
2013-6-13
编辑:the cyclist
2013-6-13
If you have the vertices of the convex hull, use the polyarea() command.
2 个评论
Mariam Sheha
2013-6-13
thanx alot , but what if i have more than one vertices for that image
(convex hull i calculate: is for segmented image located at bounding box)
Walter Roberson
2013-6-14
polyarea() with a single vertex would tell you that you had area 0. Area is not meaningful until you have at least three vertices. polyarea() is somethng you would apply to the array of vertices.
更多回答(2 个)
Image Analyst
2013-6-13
For the bounding boxes, you can simply multiply the last two numbers
area=BoundingBox(3)*BoundingBox(4);
Or you can ask regionprops to calculate the areas of the convex hulls. You just need to pass your binary image into bwconvhull() and then into regionprops
chulls = bwconvhull(binaryImage);
measurements = regionprops(chulls, 'Area', 'BoundingBox');
% Compute the areas of each convex hull:
allAreas = [measurements.Area];
% Compute the area of each bounding box.
boundingBoxes = [blobMeasurements.BoundingBox];
allBBAreas = boundingBoxes(3:4:end) .* boundingBoxes(4:4:end);
3 个评论
Image Analyst
2013-6-14
You must have a really old version - time to upgrade. It's been in there for a few years now.
Walter Roberson
2013-6-13
Bounding boxes are usually represented as [x y height width] . In that representation, the area is the height multiplied by the width.
1 个评论
Mariam Sheha
2013-6-13
Thanks alot, i get your point and i tried it manually and it works, so you mean their are no ready function for that..
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!