MATLAB Answers

0

No value in centers when using imfindcircles

Asked by Firecky Dwika on 22 Jul 2019
Latest activity Edited by KALYAN ACHARJYA on 23 Jul 2019
Hello, im trying to detect a circle caused fungi using imfindcircles function. But when i checked workspace there are no values in centres, radii, and metric that leads to Index exceeds matrix dimensions. Can anyone help me, please?
this is the script i used:
A=imread('1.jpg');
imshow(A)
B=rgb2gray(A);
figure, imshow(B)
[centers, radii, metric] = imfindcircles(A,[15 30]);
X= centers(1:1,:);
Y= radii(1:1);
Z= metric(1:1);
viscircles(X, Y,'EdgeColor','b');

  2 Comments

Please do share image 1 (Use Clip Attach)
Please do explain, what you are trying to with 1:1?
detecting a single circle, here is the picture i use:
1.jpg

Sign in to comment.

1 Answer

Answer by KALYAN ACHARJYA on 22 Jul 2019
Edited by KALYAN ACHARJYA on 22 Jul 2019
 Accepted Answer

A=imread('1.jpg');
imshow(A);
B=rgb2gray(A);
figure,imshow(B)
[centers,radii,metric]=imfindcircles(A,[1 100]);
%........................................^^ change this as per requiremnets
viscircles(centers,radii,'EdgeColor','b');
See the results in case of my sample image
pic22.png
Please do read about return colm metric here.
Hope it helps!

  2 Comments

Thank you so much!!

Sign in to comment.