You are here : matlabImage Processingimfindcircles

# imfindcircles() - Image Processing

```centers = imfindcircles(A,radius) finds
the circles in image A whose radii are approximately
equal to radius. The output, centers,
is a two-column matrix containing the x,y coordinates
of the circles centers in the image.[centers,radii]
returns a column vector, metric, containing the
magnitudes of the accumulator array peaks for each circle (in descending
order). The rows of centers and radii correspond
= imfindcircles(___,Name,Value) specifies
additional options with one or more Name,Value pair
arguments,  using any of the previous syntaxes.Code Generation support:
Yes.MATLAB® Function Block support: No.```

### Syntax

```centers = imfindcircles(A,radius)[centers,radii]
= imfindcircles(___,Name,Value) example```

### Example

```Detection of Five Strongest Circles in an ImageRead the image into the workspace and display it.A = imread('coins.png');
imshow(A)
Find all the circles with radius r such
that 15 ≤ r ≤
30.[centers, radii, metric] = imfindcircles(A,[15 30]);
Retain the five strongest circles according to the metric
Detection of Bright and Dark Circles in an ImageRead the image into the workspace and display it.A = imread('circlesBrightDark.png');
imshow(A)

Define the radius range.Rmin = 30;
Rmax = 65;
Find all the bright circles in the image within the radius
Find all the dark circles in the image within the radius
Plot bright circles in blue.viscircles(centersBright, radiiBright,'EdgeColor','b');
Plot dark circles in dashed red boundaries.viscircles(centersDark, radiiDark,'LineStyle','--');```