- Binarize the image so that it's logical. binaryImage = grayImage > 128
- Call binaryImage = imclearborder(binaryImage) to get rid of the single line around the perimeter.
- Invert the image: binaryImage = ~binaryImage, so now black circles are white
- Call binaryImage = imclearborder(binaryImage) to get rid of the large (now white) background
- Call bwlabel: [labeledImage, numberOfCircles] = bwlabel(binaryImage). This gives you the count.
- Call measurements = regionprops(labeledImage) if you want other measurements
Counting objects in an image
조회 수: 220(최근 30일)
Dear Researchers, I have a problem of counting objects in an image. Suppose I have the below image (below link)
which i got after segmentation.
how can I count the small circles in the middle of the image. Kindly suggest
Image Analyst 2013년 1월 7일
편집: Image Analyst 2013년 1월 7일
See my Image Segmentation Tutorial in my File Exchange if you want an example.