How i can find and calculate the diameter?
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
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
Walter Roberson
le 26 Nov 2015
regionprops() 'MajorAxisLength' and 'MinorAxisLength' more or less fits an ellipse.
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!