imfindcircles doesn't work
显示 更早的评论
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 个评论
Image Analyst
2025-6-29
Are you trying to find the mask, which would be the overall circle, or circles inside the circular area? Please indicate what circles you expect to find. Obviously the overall mask could be found by thresholding:
maskBoundary = bwboundaries(AA1 > 0);
If you want circles within that, your data is too blurry and indistinct to find with imfindcircles. You'll have to use a different method to find whatever it is you expect to find in that blurry image.
Also, size() returns [rows, columns] and it's convention to have x be horizontal - the opposite of what you have. You have x as rows (vertical) and y as columns (horizontal dimension) which is the opposite of convention though in this case since they're both 512 it doesn't make any different. Nonetheless, to be less confusing, you should choose descriptive variable names, like
[rows, columns, numberOfColorChannels] = size(grayImage);
John
2025-6-29
Image Analyst
2025-6-30
If you have any more questions, then attach your image and code to read it in with the paperclip icon after you read this:
采纳的回答
更多回答(1 个)
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);
类别
在 帮助中心 和 File Exchange 中查找有关 Just for fun 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


