Asked by Mariam Sheha
on 13 Jun 2013

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

Answer by the cyclist
on 13 Jun 2013

Edited by the cyclist
on 13 Jun 2013

Accepted answer

If you have the vertices of the convex hull, use the polyarea() command.

Mariam Sheha
on 13 Jun 2013

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
on 14 Jun 2013

Answer by Image Analyst
on 13 Jun 2013

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);

Mariam Sheha
on 13 Jun 2013

Thanx alot ;
Rally your answer is very usefull....
only i wana to ask if you are sure that their is a command named: *bwconvhull* because it's undefined ?!!

Thank you :)

Image Analyst
on 14 Jun 2013

You must have a really old version - time to upgrade. It's been in there for a few years now.

Mariam Sheha
on 14 Jun 2013

Answer by Walter Roberson
on 13 Jun 2013

Bounding boxes are usually represented as [x y height width] . In that representation, the area is the height multiplied by the width.

Mariam Sheha
on 13 Jun 2013

Opportunities for recent engineering grads.

## 2 Comments

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/78971#comment_154838

When you say "already get it's parameters", could you be more specific about what information you already have?

## Mariam Sheha (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/78971#comment_154857

FOR EXAMPLE: Bounding Box Parmeters for image: 113.5000 138.5000 407.0000 259.0000