imfindcircles doesn't work
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
John
am 29 Jun. 2025
Kommentiert: Mathieu NOE
am 6 Jul. 2025
The image looks normal with range from 0 to 4096:

[x,y] = size(AA1); % output x and y both 512
Obviously radius range is [x/4 x/2].
However, both of below:
[centers, radii, metric] = imfindcircles(AA1,[fix(x/4) fix(x/2)],'ObjectPolarity','bright')
[centers, radii, metric] = imfindcircles(AA1,[fix(x/4) fix(x/2)])
output:
centers = []
radii = []
metric = []
changed to [x/6 x/2] doesn't help.
Thank you for finding the issue!
3 Kommentare
Image Analyst
am 30 Jun. 2025
If you have any more questions, then attach your image and code to read it in with the paperclip icon after you read this:
Akzeptierte Antwort
Mathieu NOE
am 30 Jun. 2025
hello
let's try with your image
AA = imread('circle.png');
AA = rgb2gray(AA);
BW = imbinarize(AA);
[B,L,N] = bwboundaries(BW);
whos
figure;imshow(BW)
hold on
%Display object boundaries in red and hole boundaries in green.
N
for k=1:length(B),
boundary = B{k};
if(k > N)
plot(boundary(:,2), boundary(:,1), 'g','LineWidth',2);
else
plot(boundary(:,2), boundary(:,1), 'r','LineWidth',2);
end
end
[m,n] =size(BW);
[centers,radii]=imfindcircles(BW,round([n/4,n/2]))
3 Kommentare
Image Analyst
am 4 Jul. 2025
help visboundaries
Mathieu NOE
am 6 Jul. 2025
hello @Image Analyst
tx for the info, I'll try to remember
as you already know , I am not truly an image expert , that's not my every day job
I'm sometimes trying to improve my basic skills in that field
don't be surprised if my answers are still a bit "basic"
Weitere Antworten (1)
Matt J
am 30 Jun. 2025
Verschoben: Image Analyst
am 4 Jul. 2025
I can't reproduce the problem you claim to have with a binarized disk. That case is pretty well-handled by imfindcircles:
n=300;
[x,y]=deal(1:n);
mask=hypot(x-mean(x),y'-mean(y))<=n/3;
[centers,radii]=imfindcircles(mask,[n/4,n/2])
imshow(mask,[])
viscircles(centers,radii);
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!