Diameter of Almost circular objects and degree of circularity
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, I am trying to measure the diameter of central white spot and the dark area.
I understand they perfect circles but I'd like to get a close estimation and also a measure of circularity (I believe by a ratio of perimeter^2/area).
I thought imfindcircles would work, I have tried with both a binarised image and just the raw image (12 bit Tiff)
The size of my image is 300x300 pixels.
This was my attempt, - but its failing to find any circles.
IM=getimage(app.UIAxes2);
figure
ax1=subplot(1,3,1);
myImagesc(app,ax1,IM); %My version of ImageSc (i.e. force colormap gray)
%Binarize if required
mn=mean2(IM)
th=mn*0.5
% IM(IM<th)=0;
% IM(IM>=th)=1;
ax2=subplot(1,3,2);
myImagesc(app,ax2,IM);
%Find Circles
[centers, radii, metric] = imfindcircles(IM,[15 400],'ObjectPolarity','dark') %I've also tried "bright"
viscircles(ax2,centers, radii,'EdgeColor','b');
0 件のコメント
採用された回答
Image Analyst
2023 年 1 月 17 日
Just threshold, call imclearborder, and then regionprops, asking for EquivDiameter. Let me know if you can't figure it out.
5 件のコメント
Image Analyst
2023 年 1 月 17 日
So I take it that you want the white spot inside the black disc, but there may or may not be a white spot present, right?
Is there always just one bubble/drop inside the black disc? Is there a minimum size they/it will be? Like anything smaller than 100 pixels is noise? What I'd do is something like this
mask = grayImage > 128
mask = imclearborder(mask); % Get rid of surround.
mask = bwareafilt(mask, 1); % Take largest blob only.
mask = imfill(mask, 'holes'); % In case there are any black specks inside the white drop.
props = regionprops(mask, 'Centroid', 'EquivDiameter');
if ~isempty(props)
xCenter = props.Centroid(1);
yCenter = props.Centroid(2);
viscircles([xCenter, yCenter], props.EquivDiameter, 'Color', 'r');
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Segmentation and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!