MATLAB Answers

farhat
0

How to count the number of detected objects in the image?

Asked by farhat
on 21 Jul 2013
I Want to develop an application that can count the number of objects in an images. It's not important to know the shape of the objects. I just need the information of how many objects in an image.
An i want that it can be implemented in many images, is it possible?
How to do that?
Here is my code :
a=citra1;
a_citra_keabuan = rgb2gray(a);
threshold = graythresh(a_citra_keabuan);
a_bww = im2bw(a_citra_keabuan,threshold);
a_bw = bwareaopen(a_bww,30);
se = strel('disk',2);
a_bw = imclose(a_bw,se);
a_bw=~a_bww;
[labeled,numObjects]=bwlabel(a_bw);
The "numObjects" shows the number of the detected objects in an images.
Here is the sample of the images

  0 Comments

Sign in to comment.

0 Answers