How i can find and calculate the diameter?

6 Ansichten (letzte 30 Tage)
Indra  Ginanjar A.T
Indra Ginanjar A.T am 25 Nov. 2015
Kommentiert: Walter Roberson am 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

Antworten (1)

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

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by