viscircles and imfindcircles problem

19 views (last 30 days)
elena rondina
elena rondina on 8 Feb 2016
Answered: VBBV on 28 Oct 2021
hi i'm new in matlab...i have a problem with viscircles function...i have seen the viscircles documentation but if i do the example in the sites the output image is a white background with 5 circles. the cose is:
if A = imread('coins.png');
[centers, radii, metric] = imfindcircles(A,[15 30]);
centersStrong5 = centers(1:5,:);
radiiStrong5 = radii(1:5);
metricStrong5 = metric(1:5);
viscircles(centersStrong5, radiiStrong5,'EdgeColor','b');
why the background is white?where is the image?if there is a function that find the circle in the matlab doucumenation(imfindcircles) why i can use also hough transform to detect circles?

Answers (2)

Shruti Sapre
Shruti Sapre on 10 Feb 2016
Hi Elena,
In order to see the image, you would need to add imshow(A) after "imread"
A = imread('coins.png');
imshow(A)
Could you elaborate a little more on your next question?
-Shruti

VBBV
VBBV on 28 Oct 2021
A = imread('coins.png');
imshow(A); % you forgot this line in your code
[centers, radii, metric] = imfindcircles(A,[15 30]);
centersStrong5 = centers(1:5,:);
radiiStrong5 = radii(1:5);
metricStrong5 = metric(1:5);
viscircles(centersStrong5, radiiStrong5,'EdgeColor','b');
You forgot to add this line in your code,
imshow(A);

Community Treasure Hunt

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

Start Hunting!

Translated by