Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Shape and Size Analysis of Images

Subject: Shape and Size Analysis of Images

From: Iftekhar

Date: 17 Mar, 2009 17:47:01

Message: 1 of 10

Hi,
I have an gray scale image (uint8) which I've converted to binary image from where I need some statistical data. My image is 6240*5760 but my region of interest is near a circle or ellipse. Is it possible to crop a circle or ellipse from the original binary image (as I know matrix can not be circular or elliptical)? What should be the code?

In the binary image, I have lot of near circular and elliptical shape objects. First I want to give circular shape to the all objects and I would like know to their correspopnding radius and areas as well as the number of the objects.

Secondly, I want to know the number of circular objects, their radius and corresponding areas.

Thirdly, I want to know the number of near circular objects, their radius and corresponding areas.

Forthly, I want to know the number of elliptical / near elliptical objects, their major & minor radius / diameter and corresponding areas.

Fiftly, I would like to know, how many objects exist in each column / row or If I draw lines in all column, how many objects will be intersected by the lines and their intensities. Or the summation of pixels in each column and rows from the croped circular binary image.

With my sincere gratitute I wish to have the help with code and explanation.
Best regards,
Iftekhar

Subject: Shape and Size Analysis of Images

From: Image Analyst

Date: 17 Mar, 2009 19:30:19

Message: 2 of 10

Iftekhar
Here's my responses (by number):
1. Call bwlabel(), passing it your binary image. Then pass the labeled image in to regionprops(). This requires the image processing toolbox.
2. You need to calculate the circularity, which is the ratio of perimeter squared divided by (4*area*pi). Use this to find only those objects which have a circularity less than about 3. You can calculate the Equivalent Circular Diameter (ECD) from 2*sqrt(area/pi). Radius for each circular objects is just sqrt(area/pi).
3. Same process as #2, just use different range for circularity, e.g. just consider objects with circularity between 3 and 7.
4. Check out regionprops(). It has all the measurements you need to do this.
5. Extract out columns from your 2D binary image. Then manually process this column vector to find rising and falling edges. Then go back to your original image (from which the binary image was created) to get the intensities of the objects at those pixel locations.
Regards,
ImageAnalyst

Subject: Shape and Size Analysis of Images

From: mohammad kazim

Date: 12 Dec, 2009 05:04:03

Message: 3 of 10

hii,
i also have a similar doubt, i have an image in which i have circles and rectangles of same rgb value ,
how can i determine the shapes distinctly and there centroids.
please reply, i will be thankful

best regards
kazim

Subject: Shape and Size Analysis of Images

From: ImageAnalyst

Date: 12 Dec, 2009 05:10:23

Message: 4 of 10

See the demo:
http://www.mathworks.com/matlabcentral/fileexchange/25157
It covers most of this.
Use the perimeter squared to area ratio to distinguish between
different shapes such as circles and squares.

Subject: Shape and Size Analysis of Images

From: mohammad kazim

Date: 12 Dec, 2009 14:01:05

Message: 5 of 10

thanks
its helpful
regards
kazim

Subject: Shape and Size Analysis of Images

From: mohammad kazim

Date: 12 Dec, 2009 14:08:07

Message: 6 of 10

but what if image has both rectangles and circles within,,
the demo provided is just for circles'

Subject: Shape and Size Analysis of Images

From: ImageAnalyst

Date: 12 Dec, 2009 14:46:31

Message: 7 of 10

Use the perimeter squared to area ratio to distinguish between
different shapes such as circles and squares.

Subject: Shape and Size Analysis of Images

From: mohammad kazim

Date: 14 Dec, 2009 03:09:06

Message: 8 of 10

thanks..
regards
kazim

Subject: Shape and Size Analysis of Images

From: Vikram

Date: 18 Jan, 2010 13:10:21

Message: 9 of 10

"Image Analyst" <imageanalyst@mailinator.com> wrote in message <gpotob$cod$1@fred.mathworks.com>...
> Iftekhar
> Here's my responses (by number):
> 1. Call bwlabel(), passing it your binary image. Then pass the labeled image in to regionprops(). This requires the image processing toolbox.
> 2. You need to calculate the circularity, which is the ratio of perimeter squared divided by (4*area*pi). Use this to find only those objects which have a circularity less than about 3. You can calculate the Equivalent Circular Diameter (ECD) from 2*sqrt(area/pi). Radius for each circular objects is just sqrt(area/pi).
> 3. Same process as #2, just use different range for circularity, e.g. just consider objects with circularity between 3 and 7.
> 4. Check out regionprops(). It has all the measurements you need to do this.
> 5. Extract out columns from your 2D binary image. Then manually process this column vector to find rising and falling edges. Then go back to your original image (from which the binary image was created) to get the intensities of the objects at those pixel locations.
> Regards,
> ImageAnalyst

Subject: Shape and Size Analysis of Images

From: ravitej

Date: 21 Nov, 2013 03:45:15

Message: 10 of 10

how to find the perimeter and area of object in image.
from regionprops im getting some matrix for perimeter but not single value.
please help me.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us