How to count the number of detected objects in the image?
4 views (last 30 days)
Show older comments
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
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!