regionprops circularity value >1 and 0 ?

Hello,
I calculated for a binary image the circularity using the regionprops function with this formula:
allCircularities1 = allPerimeters1.^2 ./ (4* pi*allAreas1);
I got the following circularity values : 2.933 ; 1.5260 ; 3.4890 ; 0.5380 ; 1.1568 0 ; 0 ; 0.5591.
I know that a circle has a circularity of nearly 1. As i understand the circularity is the roundness of an object / blob ? So my question is what the values greater 1 implicate? There isn't an object available that is 'rounder' than a circle.
My second question is the circularity value = 0. I checked the perimeter for that small blob. It also has the value 0. Why is that so ? Is the blob too small for the regionprops perimeter function ?

3 Comments

(It looks to me as if you have already been examining the discussion at https://www.mathworks.com/matlabcentral/answers/167366-how-to-measure-circularity )
Yes, sir. I did examine this discussion and others.
See this updated answer regarding circularity values greater than 1.

Sign in to comment.

 Accepted Answer

It seems like you're getting circularities less than 1 for perfectly rectangular blocks. The formula is not that accurate for small blobs due to digitization errors and you might need to filter on something in addition to circularity, such as area. Try the attached program to see. Be sure to change the filename if you need to.
0000 Screenshot.png

6 Comments

Thank you for your reply and your tip on filtering the area. I looked through your file. May I ask what the difference is when I look up the area, perimeter and circularity in the workspace and your code is ? As I understand you display the blobs with their area, perimeter and curcularity in the figure.
For the purple blob I get a value greater than 1. Is this value also wrong due to digitalization errors?
regionprops https://www.mathworks.com/help/images/ref/regionprops.html#buoixjn-1-properties calculates perimeter as the sum of the distance between each adjacent pair of perimeter pixels. That calculates sqrt(2) on diagonal pixels, and ends up counting some sections more than once. For example,
***
****
the drop down might be approximating an angled line, but it gets counts 1 for each segment.
For small regions, the exterior can get badly overcounted.
Hey, @image analyst
sir i have find the region props on image.
propied= regionprops(Image, 'Area', 'BoundingBox', 'PixelIdxList');
now i have Structure in which i have 3 field. in BoundingBox field i want sort the 3rd column values. can you please tell how can i do that?
Please sir help me..
allBB = vertcat(propied.BoundingBox);
[~, sortorder] = sort(allBB(:,3));
sorted_propied = propied(sortorder);
Now sorted_propied would be all of the properties that you asked for, sorted according to increasing width of the region.
See also this updated answer regarding circularity values greater than 1.

Sign in to comment.

More Answers (1)

R2023a Update: Correcting regionprops Circularity Measurements That Are Greater Than 1.0
Image Processing Toolbox R2023a or Later
In releases R2023a or later, the Circularity computation in regionprops has been revised to correct a bias towards higher values, and it no longer returns values greater than 1.0.
See this 21-Mar-2023 blog post for a detailed explanation.
if verLessThan("images","11.7")
error("Use this code with releases R2023a or later.")
end
A = imread("text.png");
props = regionprops("table",A,"Circularity");
Image Processing Toolbox R2019a to R2022b
In earlier releases, you can apply the same correction that was introduced in R2023a by adapting the following example. Note that the call to regionprops below uses the form that returns a table because it makes the correction steps easier.
if verLessThan("images","10.4") || ~verLessThan("images","11.7")
error("Use this code with releases R2019a through R2022b.")
end
A = imread("text.png");
props = regionprops("table",A,["Circularity" "Perimeter"]);
c = props.Circularity;
p = props.Perimeter;
r_eq = p/(2*pi) + 0.5;
correction = (1 - (0.5./r_eq)).^2;
props.Circularity = min(c .* correction, 1);
Image Processing Toolbox R2018b or Earlier
In these older releases, the function regionprops did not compute Circularity. You can compute it by adapting the following example.
if ~verLessThan("images","10.4")
error("Use this code with releases R2018b or earlier.")
end
A = imread("text.png");
props = regionprops("table",A,["Area" "Perimeter"]);
a = props.Area;
p = props.Perimeter;
c = 4*pi*a ./ (p.^2);
r_eq = p/(2*pi) + 0.5;
correction = (1 - (0.5./r_eq)).^2;
props.Circularity = min(c .* correction, 1);

2 Comments

release: 2021b
When running this part:
c = props.Circularity;
p = props.Perimeter;
r_eq = p/(2*pi) + 0.5;
correction = (1 - (0.5./r_eq)).^2;
props.Circularity = min(c .* correction, 1);
Returns error:
Scalar structure required for this assignment.
props.Circularity = min(c .* correction, 1);
Adrián, did you call regionprops with "table" as the first argument? Like this:
props = regionprops("table",A,["Circularity" "Perimeter"]);

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!