Finding only circular objects?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
Image Analyst
2016년 2월 15일
You can compute the circularity. See my attached shape recognition demo.
댓글 수: 2
Image Analyst
2016년 2월 15일
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);
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!