How i can find and calculate the diameter?

9 vues (au cours des 30 derniers jours)
Indra  Ginanjar A.T
Indra Ginanjar A.T le 25 Nov 2015
Commenté : Walter Roberson le 26 Nov 2015
Halo, I have a region of interest detected by a segmentation method and canny edge detection. I want to find and calculate the diameter of this region. How can i do this with matlab? This is the mask of the region.
thanks

Réponses (1)

Image Analyst
Image Analyst le 25 Nov 2015
Is the perimeter solid, or does it have gaps in it? First of all, crop away that gray border. Then call imfill(binaryImage, 'holes') to make it solid. Then call regionprops() and ask for EquivDiameter. See my Image Segmentation Tutorial for a full demo. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
croppedImage = grayImage(row1:row2, col1:col2);
binaryImage = croppedImage > 128; % Only if it's not already binary.
binaryImage = imfill(binaryImage, 'holels');
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'EquivDiameter');
EquivalentCircularDiameter = measurements.EquivDiameter
  2 commentaires
Indra  Ginanjar A.T
Indra Ginanjar A.T le 26 Nov 2015
thankyou sir, how about using fit ellipse algorithm? it can?
Walter Roberson
Walter Roberson le 26 Nov 2015
regionprops() 'MajorAxisLength' and 'MinorAxisLength' more or less fits an ellipse.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by