Circularity Metric using regionprops
12 views (last 30 days)
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
Supraja on 2 Jun 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!