Finding only circular objects?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
rupam baruah
le 15 Fév 2016
Commenté : Image Analyst
le 15 Fév 2016
I have a binary image with different shapes of objects. I want to calculate the number of only circular objects in the image. How can I do that by using regionprops function?
Thanks
0 commentaires
Réponse acceptée
Image Analyst
le 15 Fév 2016
You can compute the circularity. See my attached shape recognition demo.
2 commentaires
Image Analyst
le 15 Fév 2016
use ismember and bwlabel
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'Area', 'Perimeter');
allAreas = [measurements.Area];
allPerimeters = [measurements.Perimeter];
circularities = 4*pi*allAreas ./ allPerimeters.^2;
circleIndexes = find(circularities > 0.85);
circlesOnlyImage = ismember(labeledImage, circleIndexes) > 0;
[labeledImage, numCircles] = bwlabel(circlesOnlyImage);
Plus de réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!