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

조회 수: 60 (최근 30일)
Hanuman Wable
Hanuman Wable 2013년 12월 20일
이동: DGM 2023년 2월 13일
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일
편집: 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
muhamad zulhairi zailan 2018년 11월 7일
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