I want to develop an application that can count the number of objects in an image. It is not important to know the shape of the objects. I just need information on how many objects are in the image.
And I want to be able to implement it with many images. Is it possible? How to do it?
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);
numObjects shows the number of detected objects in images.
Here is an example of images
Images1
Images2
source share