# Radius and coordinates of the center for a big circle in a bidimensional image

3 visualizaciones (últimos 30 días)
matnewbie el 11 de Feb. de 2016
Respondida: Anand el 11 de Feb. de 2016
I have a bidimensional (N x N) matrix of pixels like the one shown in the attached figure. Black areas contain zero values, while other areas contain random non-zero values. How could I determine the radius (in pixels) and coordinates of the center for the big circle? Consider that its center doesn't correspond to the center of the matrix, like in the figure.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Image Analyst el 11 de Feb. de 2016
Editada: Image Analyst el 11 de Feb. de 2016
Get a binary image by thresholding. Then fill holes, label, and call regionprops().
binaryImage = grayImage > 10; % or whatever value works.
% Fill holes
binaryImage = imfill(binaryImage, 'holes');
% Label
labeledImage = bwlabel(binaryImage);
% Measure
measurements = regionprops(labeledImage, 'EquivDiameter');
% Extract
By the way, instead of the very verbose and overly complicated "bidimensional (N x N) matrix of pixels", most people would simply just say "2D image".
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
matnewbie el 11 de Feb. de 2016
Thanks for your answer. I modified the original post, since I forgot to say that I am also interested in determining the coordinates of the center for the big circle. Is it possible to obtain the same results without using functions from the Image Processing Toolbox? Since I have a matrix of values, is it possible to find the coordinates of the center by minimizing the number of black pixels (zero values) from the edges of the black square?

Iniciar sesión para comentar.

### Más respuestas (1)

Anand el 11 de Feb. de 2016
You can use the awesome imfindcircles function to do this as well.
Here's some code that should help:
% Find circles in the image
radiusRange = [20 30]; % You need an approximate range of what you expect the radius to be.
% Display found circles
imshow(I)
The variables centers and radii hold what you are looking for.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Image Category Classification en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by