Main Content

La traducción de esta página aún no se ha actualizado a la versión más reciente. Haga clic aquí para ver la última versión en inglés.

Medir el radio de un rollo de cinta

Este ejemplo muestra cómo medir el radio de un rollo de cinta que está parcialmente oculto por el portarrollos. Utilice imfindcircles para realizar esta tarea.

Paso 1: Leer la imagen

Lea tape.png.

RGB = imread('tape.png');
imshow(RGB);

hTxt = text(15,15,'Estimate radius of the roll of tape',...
     'FontWeight','bold','Color','y');

Figure contains an axes object. The axes object contains 2 objects of type image, text.

Paso 2: Encontrar el círculo

Encuentre el centro y el radio del círculo de la imagen utilizando imfindcircles.

Rmin = 60; 
Rmax = 100;
[center, radius] = imfindcircles(RGB,[Rmin Rmax],'Sensitivity',0.9)
center = 1×2

  236.9291  172.4747

radius = 79.5305

Paso 3: Destacar el contorno y el centro del círculo

% Display the circle
viscircles(center,radius);

% Display the calculated center
hold on;
plot(center(:,1),center(:,2),'yx','LineWidth',2);
hold off;

delete(hTxt);
message = sprintf('The estimated radius is %2.1f pixels', radius);
text(15,15,message,'Color','y','FontWeight','bold');

Figure contains an axes object. The axes object contains 5 objects of type line, image, text. One or more of the lines displays its values using only markers

Consulte también

|

Temas relacionados