How to count the number of object present in binary image?

21 次查看(过去 30 天)
Hello sir, i am going to count the number of object present in binary image. so any of you please suggest me regarding counting object.because i have problem during count such object. thank you
  1 个评论
sanhita das
sanhita das 2018-4-7
移动:DGM 2023-2-13
sir,i want to show paragraphs from document image.pls tell the algoritm name. I attach a input file.and how to extract paragraph from this image.please help me

请先登录,再进行评论。

回答(3 个)

Sabarinathan Vadivelu
编辑:Sabarinathan Vadivelu 2013-12-20
You can use bwconncomp.
cc = bwconncomp(yourBinaryImage,4);
number = cc.NumObjects;

Image Analyst
Image Analyst 2013-12-20
Here's yet another way
[labeledImage, numberOfObject] = bwlabel(binaryImage);
  3 个评论
romaisa sabih
romaisa sabih 2016-5-18
sir,i have to count the active fingers in my image.how can i do this ? please help.

请先登录,再进行评论。


David Sanchez
David Sanchez 2013-12-20
If you are planning to do something with those objects, you could be interested in using regionprops. Besides the number of objects within the image, you can retrieve any other property of the objects, such as the area, centroid, orientation,....
BW = imread('text.png');
s = regionprops(BW, 'Area');
N_objects = numel(C);
For all the options, take a look at
doc regionprops
  2 个评论
muhamad zulhairi zailan
hello sir, how to count the object using area parameter, which mean i have the image and i want to count the object in that image using range of area parameter and i want to count the object refer to it area parameter? thanks sir your reply very appreciated.
Image Analyst
Image Analyst 2018-11-7
I don't know what you want. By the way, the code above is not correct. It should say
N_objects = length(s)
That number will be the same regardless which attributes you measure (area, perimeter, or whatever).

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by