This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Measuring the Radius of a Roll of Tape

This example shows how to measure the radius of a roll of tape, which is partially obscured by the tape dispenser. Utilize imfindcircles to accomplish this task.

Step 1: Read Image

Read in tape.png.

RGB = imread('tape.png');

hTxt = text(15,15,'Estimate radius of the roll of tape',...

Step 2: Find the Circle

Find the center and the radius of the circle in the image using imfindcircles.

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

  236.9291  172.4747

radius = 79.5305

Step 3: Highlight the Circle Outline and Center

% Display the circle

% Display the calculated center
hold on;
hold off;

message = sprintf('The estimated radius is %2.1f pixels', radius);

See Also


Related Topics