Filter löschen
Filter löschen

How to count number of circles of a gray scale image?

12 Ansichten (letzte 30 Tage)
Ruhul Amin
Ruhul Amin am 13 Dez. 2015
Kommentiert: Image Analyst am 17 Jun. 2022
I want to count number of circles of a gray scale image. I have attached the sample image. I just want to count the number of circle of that image and fill the gaps of that circle. What should i do??

Akzeptierte Antwort

Image Analyst
Image Analyst am 14 Dez. 2015
How many do you see? I see two circular black discs plus a bunch of other blobs that have irregular shapes, though some parts of their perimeters are circular.
Then you can count them with bwlabel();
[~, NumBlobs] = bwlabel(binaryImage);
Another way is to use regionprops() to compute the area and perimeter of the blobs and compute the circularity and keep only blobs that are sufficiently close to being circular.
I can't do it all for you but if you have questions, attach whatever code you have.
  4 Kommentare
Fika Umami
Fika Umami am 17 Jun. 2022
this post is quite old but ca
n i ask here??
im looking fora solution tom problem but i haven't found it yet
i tried to calculate the circle from the canny result but the results did not match my manualy calculation, the results were too many
this my code
edge_final = handles.edge1;
cla('reset')
imshow(edge_final)
[B,L] = bwboundaries(edge_final,'noholes');
stats = regionprops(L,'All');
bw2 = zeros(size(edge_final,1),size(edge_final,2));
for k = 1:length(B)
boundary = B{k};
delta_sq = diff(boundary).^2;
perimeter = stats(k).Perimeter;
area = stats(k).Area;
metric = 4*pi*area/perimeter^2;
bbox = stats(k).BoundingBox;
eccentricity = stats(k).Eccentricity;
MajorAxisLength = stats(k).MajorAxisLength;
MinorAxisLength = stats(k).MinorAxisLength;
d = MajorAxisLength/MinorAxisLength;
position = [boundary(1,2),boundary(1,1)];
if metric > 0.9
bw2(L==k) = 1;
[handles.D handles.Num_lingkaran]=bwlabel(bw2);
set(handles.text2,'string', handles.Num_lingkaran);
end
end
guidata(hObject, handles);
can you help me to o it?
Image Analyst
Image Analyst am 17 Jun. 2022
I'd create your own post for this. Attach your own original input image.
Also explain exactly what "calculate the circle" means because that is very vague and there could be several possible answers for that depending on exactly what that means.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by