How i can find and calculate the diameter?

8 views (last 30 days)
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

Answers (1)

Image Analyst
Image Analyst on 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 Comments
Indra  Ginanjar A.T
Indra Ginanjar A.T on 26 Nov 2015
thankyou sir, how about using fit ellipse algorithm? it can?
Walter Roberson
Walter Roberson on 26 Nov 2015
regionprops() 'MajorAxisLength' and 'MinorAxisLength' more or less fits an ellipse.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!