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!


