Circularity Metric using regionprops
显示 更早的评论
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 个)
Supraja
2023-6-2
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!
类别
在 帮助中心 和 File Exchange 中查找有关 Region and Image Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
