Counting objects in an image

257 ビュー (過去 30 日間)
subrajeet
subrajeet 2013 年 1 月 7 日
コメント済み: Beenish Ishtiaq 2021 年 8 月 5 日
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

採用された回答

Image Analyst
Image Analyst 2013 年 1 月 7 日
編集済み: Image Analyst 2013 年 1 月 7 日
  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 件のコメント
Image Analyst
Image Analyst 2013 年 1 月 7 日
It's just basic, elementary image segmentation via intensity thresholding. Nothing fancy at all. See updated instructions above.

サインインしてコメントする。

その他の回答 (3 件)

Thomas
Thomas 2013 年 1 月 7 日
編集済み: John Kelly 2017 年 11 月 8 日
You could use techniques shown in many MATLAB image processing demos.
  1 件のコメント
subrajeet
subrajeet 2013 年 1 月 7 日
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.

サインインしてコメントする。


SANAHA PATHAN
SANAHA PATHAN 2016 年 7 月 25 日
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 件のコメント
Image Analyst
Image Analyst 2016 年 10 月 8 日

サインインしてコメントする。


Beenish Ishtiaq
Beenish Ishtiaq 2021 年 8 月 3 日
Need code for counting different shapes separatelly which shows each shape result respectively in different edit boxes in GUI matlab..
  2 件のコメント
Beenish Ishtiaq
Beenish Ishtiaq 2021 年 8 月 5 日
error in ''catch''

サインインしてコメントする。

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by