Find the circle for the image using imfindcircles

2 views (last 30 days)
Hello,
I have an image for which i need to determine the outer circle and then find the centre for the outer circle.I am using the function
imfindcircles()
I have the following code to do this :
img2 = imread('Image.bmp'); imshow(img2);
% Find all the circles with radius >= 15 and radius <= 30
[centers, radii, metric] = imfindcircles(img2,[15 416]);
% Retain the five strongest circles according to metric values
centersStrong5 = centers(1:1,:);
radiiStrong5 = radii(1:1);
metricStrong5 = metric(1:1);
% Draw the circle perimeter for the five strongest circles
viscircles(centersStrong5, radiiStrong5,'EdgeColor','b');
but when i run this code i am getting the following error.
Error in Cap_Test (line 16)
centersStrong5 = centers(1:1,:);
Please let me know the reason for this and how to solve this.
I am attaching the image here for which I need to find the centre.
The radius for this is around 416.
Looking forward to hear from you.
Thanks Pankaja

Answers (0)

Categories

Find more on Programming 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!