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
Subrajeet

 Réponse acceptée

Image Analyst
Image Analyst le 7 Jan 2013
Modifié(e) : Image Analyst le 7 Jan 2013

4 votes

  1. Binarize the image so that it's logical. binaryImage = grayImage > 128
  2. Call binaryImage = imclearborder(binaryImage) to get rid of the single line around the perimeter.
  3. Invert the image: binaryImage = ~binaryImage, so now black circles are white
  4. Call binaryImage = imclearborder(binaryImage) to get rid of the large (now white) background
  5. Call bwlabel: [labeledImage, numberOfCircles] = bwlabel(binaryImage). This gives you the count.
  6. Call measurements = regionprops(labeledImage) if you want other measurements
See my Image Segmentation Tutorial in my File Exchange if you want an example.

2 commentaires

subrajeet
subrajeet le 7 Jan 2013
@Image Analyst from core of my heart I want to thankyou. Really I could not do it from yesterday. But one one thing can you tell me using which image processing technique this was achieved.
Thanks a lot again.
Image Analyst
Image Analyst le 7 Jan 2013
Modifié(e) : Image Analyst le 7 Jan 2013
It's just basic, elementary image segmentation via intensity thresholding. Nothing fancy at all. See updated instructions above.

Connectez-vous pour commenter.

Plus de réponses (3)

Thomas
Thomas le 7 Jan 2013
Modifié(e) : John Kelly le 8 Nov 2017

0 votes

You could use techniques shown in many MATLAB image processing demos.

1 commentaire

subrajeet
subrajeet le 7 Jan 2013
Thomas U can see in my image the circular objects in the centre have immideate neighbors as white pixels. But again beyond white pixels I have black pixels. So i could not understand how can I have the access over the center circles. I desire if by some means I can assign the outer black pixels as 1 or make them white then I can count the circles. But I am unable to do that.

Connectez-vous pour commenter.

SANAHA PATHAN
SANAHA PATHAN le 25 Juil 2016

0 votes

i want to count number of silkworm eggs from this figure, i used L=Count(binaryfig) this command for counting number of objects ,this command works but i actually dont know what actually this command count,and result of this command is different every time

3 commentaires

Image Analyst
Image Analyst le 25 Juil 2016
SANAHA, take a look at this link and then if you still have questions, post a new Question (not here) and upload your code and image(s). We actually don't know what your Count() function does either so be sure that's included in the code you upload.
anna
anna le 5 Oct 2016
Modifié(e) : anna le 5 Oct 2016
hey I segmented blue nuclei from a blood smear image using k means color segmentation. how can i count the number of segmented blue nuclei. could u please help me with the code for counting [ cant use imfindcircle because the segmented nuclei are not exactly cirlce in shape ]

Connectez-vous pour commenter.

Beenish Ishtiaq
Beenish Ishtiaq le 3 Août 2021

0 votes

Need code for counting different shapes separatelly which shows each shape result respectively in different edit boxes in GUI matlab..

2 commentaires

Image Analyst
Image Analyst le 3 Août 2021
See my attached demos. I find that usually using findpeaks() to count the number of peaks in the plot of distance of perimeter from centroid works pretty well.
Beenish Ishtiaq
Beenish Ishtiaq le 5 Août 2021
error in ''catch''

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by