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

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 comentario

sanhita das
sanhita das el 7 de Abr. de 2018
Movida: DGM el 13 de Feb. de 2023
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

Iniciar sesión para comentar.

Respuestas (3)

Sabarinathan Vadivelu
Sabarinathan Vadivelu el 20 de Dic. de 2013
Editada: Sabarinathan Vadivelu el 20 de Dic. de 2013
You can use bwconncomp.
cc = bwconncomp(yourBinaryImage,4);
number = cc.NumObjects;
Here's yet another way
[labeledImage, numberOfObject] = bwlabel(binaryImage);
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 comentarios

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.
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).

Iniciar sesión para comentar.

Categorías

Más información sobre Images en Centro de ayuda y File Exchange.

Preguntada:

el 20 de Dic. de 2013

Movida:

DGM
el 13 de Feb. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by