How to find the internal and external radius of a ring using matlab image processing toolbox

24 visualizaciones (últimos 30 días)
For example get this image

Respuesta aceptada

Akira Agata
Akira Agata el 13 de Nov. de 2017
By measuring the 'equivalent diameter' for each region, you can obtain the inner and outer radius. Here is an example.
% Read your image and binarize it
I = imread('Oil_Seal_Top_370003A__34285.1413827494.1280.1280.jpg');
Igray = rgb2gray(I);
BW = imbinarize(Igray);
% Measure the outer radius
BWout = ~BW;
BWout = imfill(BWout,'holes');
statOuter = regionprops(BWout,{'EquivDiameter','Centroid'});
outerRadius = statOuter.EquivDiameter/2;
% Measure the inner radius
BWin = imclearborder(BW);
BWin = imopen(BWin, strel('disk',5)); % Remove noise
statInner = regionprops(BWin,{'EquivDiameter','Centroid'})
innerRadius = statInner.EquivDiameter/2;
% Show the result
figure
imshow(I)
hold on
viscircles(statOuter.Centroid, outerRadius,'Color','r')
viscircles(statInner.Centroid, innerRadius,'Color','r')
The result is:
>> innerRadius
innerRadius =
278.8980
>> outerRadius
outerRadius =
374.5866
  1 comentario
Rangika Mark
Rangika Mark el 13 de Nov. de 2017
Thank you Mr.Akira Agata for mind me the solutions this is simple,early I used imfindcircle function in that I have to input the pixel value

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox 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