Circularity Metric using regionprops
Afficher commentaires plus anciens
Hello, this is a related to an earlier question but Im after a different parameter so I have asked another question. Apologies if I should have contrinued on the previous question. Here goes!
I have an image of a bubble (the dark area in the 1st image) and not only do I want to estimate its diameter, but also its circularity. I have used I.A's suggestions as well as the fact that a common metric for circularity is Perimeter^2 / 4pi*Area = 1 for a circle.

However, I'd like to explore another metric that looks interesting. Its the difference betweent he largest and smallest circle

However for once I have no idea where to start! (sorry, I know we should attempt ourself first, but I am stuck on this one)
(note that sometimes inside the water drop (i.e. the dark area) there can be bright spots), these need to be ignored) - its the edge of the dark ara that I want to quantify
Thanks
1 commentaire
Réponses (1)
Supraja
le 2 Juin 2023
I understand that you want to find the circularity of the image.
You can try the following code:
% Load the image and convert to grayscale
img = imread('myimage.jpg');
gray = rgb2gray(img);
% Apply a threshold
threshold = graythresh(gray);
bw = imbinarize(gray, threshold);
% Label and calculate properties of the connected regions
labeled = bwlabel(bw);
props = regionprops(labeled, 'Area', 'Perimeter');
% Calculate circularity and display the output
area = props.Area;
perimeter = props.Perimeter;
circularity = (perimeter^2)/(4*pi*area);
disp(['Circularity: ', num2str(circularity)]);
Hope this helps!
1 commentaire
Jason
le 2 Nov 2023
Catégories
En savoir plus sur Region and Image Properties dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
