filling Index issues imfindcircles
Show older comments
Im having issue where i think the index is looking for instances of detected circles but it either is not filling the index or maybe there isnt enough to fill the array but im having issue getting this to work. its from the help documentation so i expected it to just work but im still having trouble and thus am having trouble understanding how to use imfindcircles. I tried using edge(canny) and using a binary image to see if that would make it easier to find circles but im still hvaing issues.
A = imread('coins.png');
imshow(A)
[centers, radii, metric] = imfindcircles(A,[15 30]);
centersStrong5 = centers(1:5,:);
radiiStrong5 = radii(1:5);
metricStrong5 = metric(1:5);
viscircles(centersStrong5, radiiStrong5,'EdgeColor','b');
Accepted Answer
More Answers (1)
I don't know what this means: "not filling the index or maybe there isnt enough to fill the array". The demo and your code does exactly what it says - it finds all the circles and displays the "strongest" 5 circles only.
A = imread('coins.png');
imshow(A)
[centers, radii, metric] = imfindcircles(A,[15 30]);
centersStrong5 = centers(1:5,:);
radiiStrong5 = radii(1:5);
metricStrong5 = metric(1:5);
viscircles(centersStrong5, radiiStrong5,'EdgeColor','b');
If you want to display all circles, just display them all, not just 5 of them:
A = imread('coins.png');
imshow(A)
[centers, radii, metric] = imfindcircles(A,[15 30]);
viscircles(centers, radii,'EdgeColor','b');
So I'm not really sure what you're asking (because I couldn't understand that phrase I mentioned at the beginning.) Please explain more clearly.
It's a generic, general purpose demo of how to threshold an image to find blobs, and then measure things about the blobs, and extract certain blobs based on their areas or diameters.
Categories
Find more on Object Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

