# Circularity Metric using regionprops

조회 수: 11(최근 30일)
Jason 2023년 1월 18일
편집: Jason 2023년 1월 18일
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표시 없음숨기기 없음
Jason 2023년 1월 18일
편집: Jason 2023년 1월 18일
The last image is obtained by bwboundaries. Im guessing this could be used. I see the output B is the x,y locations of the perimeter - perhaps a centroid could be calculated and then some how the max and min distance from this centroid? This is what I've managed to do, not sure if its correct or the best way - it does look right
[B,L] = bwboundaries(bw2,'noholes');
disp('Boundaries')
B
BB=B{1} ;
X=BB(:,1); Y=BB(:,2);
figure
plot(X,Y,'k-','Linewidth',3);
%try and get centroids of these X,Y locations (of the perimeter)
hold on
plot(mean(X(:)),mean(Y(:)),'r+'); axis equal; grid on;
%hold off
%now calc distance of each point from the centroid
data=[];
cenX=mean(X(:)); cenY=mean(Y(:));
for i=1:length(BB)
X=BB(i,1); Y=BB(i,2);
data(i,1)=X; data(i,1)=Y;
R=sqrt((X-cenX)^2+(Y-cenY)^2)
data(i,3)=R;
end
R1=max(data(:,3))
R2=min(data(:,3))
viscircles([cenX, cenY], R1, 'Color', 'b','Linewidth',1);
viscircles([cenX, cenY], R2, 'Color', 'r','Linewidth',1); hold off; 댓글을 달려면 로그인하십시오.

### 범주

Find more on Image Type Conversion in Help Center and File Exchange

R2022b

### Community Treasure Hunt

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

Start Hunting!