# How to measure circularity??

77 views (last 30 days)
Nisreen Sulayman on 20 Dec 2014
Answered: yousra zafar on 21 Nov 2019
How to measure circularity ? What is wrong in this code?
CC=bwconncomp(BW); %BW binary image
labeled=labelmatrix(CC);
stats = regionprops(CC, 'all');
stats.circularity = ((stats.Perimeter) .^2 )./ (4*(pi*(stats.Area)))
Nisreen Sulayman on 21 Dec 2014
what are the all possible features I can use to pick the smallest circular-like component ??

Image Analyst on 20 Dec 2014
You didn't use brackets. Try it this way
allPerimeters = [stats.Perimeter];
allAreas = [stats.Area];
allCircularities = allPerimeters .^ 2 ./ (4 * pi* allAreas);
Hossain Md Shakhawat on 20 Nov 2016
How can I find the glcm features for the detected blobs.

Matt J on 21 Dec 2014
It might also be useful to check whether the Eccentricity and Solidity of a region are above a certain threshold.
Nisreen Sulayman on 22 Dec 2014
Edited: Nisreen Sulayman on 23 Dec 2014
thank you very much ... thank you

Nisreen Sulayman on 19 Jan 2015
Hi Mr. Image Analyst,
I am working on the code that you have written "test.m", I want to display more properties of the blobs in the image ... 'MajorAxisLength', 'MinorAxisLength', 'Orientation' ... After that I want to copy these values to a doc file
I have modified the code but it didn't work
Nisreen Sulayman on 22 Jan 2015
Thank you very much Mr. Analyst,
I am grateful for your help.

Nisreen Sulayman on 19 Jan 2015
I have apllied the code. How can I display the round objects in the original images in different color instead of drawing a circle around them???

Nisreen Sulayman on 29 Jan 2015
Edited: Nisreen Sulayman on 29 Jan 2015
How can I index images according to the resulted segmented image? Is there any thing related to build a database using MATLAB?
Matt J on 4 Apr 2018
@murk,
You have multiple objects in "stats" so you need to do something like,
result = ([stats.Perimeter] .^2 )./ (4*(pi*[stats.Area]))

Souhardya Roy on 6 Jul 2018
The formula is inverse of what is given.
##### 2 CommentsShowHide 1 older comment
Image Analyst on 19 Nov 2019

yousra zafar on 21 Nov 2019
i,m unable to run the code text.m attcahed above, getting error : file not found , can you share with me the image C:\Users\Rose\Documents\Temporary\im.jpg

### Categories

Find more on Image Data Workflows in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!