Please identify how many animals are in the provided image,
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have to make matlab code to determine how many animals are in this picture for a homework project. I have to count the number of animals and show a picture. I know how to use imread and imshow but I dont know how to count images and isolate them. Please help I am very confused!!!!!!
2 Kommentare
Walter Roberson
am 16 Dez. 2016
... Did an attached image get dropped, or did the image never get attached?
Image Analyst
am 17 Dez. 2016
There was no image when I replied. I don't know if there was when Simone replied (sounds like there was) but if there was, it's not there now. I wonder if it has to do with chicken counting like the other person asked about. The other common animal counting subject is fish.
Antworten (2)
Image Analyst
am 13 Dez. 2016
It looks like there are 10 animals in that photo!
See my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
I can tell you're confused, because "determine how many animals" and "count images" are two different things - they count different things (animals and images)!
0 Kommentare
Simone Hernandez
am 16 Dez. 2016
Hi! So I am not sure if I completely solved your problem, but I hope this helps.
So the code below first takes the image and inverts the colors, so that it is easier to isolate the animals in the photo. The function bwareaopen removes any extra noise in the picture. You can take a look and have a play around with the values depending on the photo itself.
Code:
bw = ~bw; bw = bwareaopen(bw,3000); stats = regionprops(bw, 'BoundingBox', 'Centroid'); imshow(bw)
Then the following simply recognizes the clusters in the image, and isloates them in red boxes. I was playing around with other photos to ensure that the code was working, but in some photos, it is hard to isolate two objects on top of one another.
hold on
for object = 1:length(stats)
bb = stats(object).BoundingBox;
bc = stats(object).Centroid;
rectangle('Position',bb,'EdgeColor','r','LineWidth',2)
plot(bc(1),bc(2), '-m+')
end
hold off
Hope this helps, and sorry for the lack of explanation, but you can take it upon yourself to learn what each individual function does. :)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Animation finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!