Please identify how many animals are in the provided image,

1 vue (au cours des 30 derniers jours)
Mike Jordan
Mike Jordan le 13 Déc 2016
Commenté : Image Analyst le 17 Déc 2016
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 commentaires
Walter Roberson
Walter Roberson le 16 Déc 2016
... Did an attached image get dropped, or did the image never get attached?
Image Analyst
Image Analyst le 17 Déc 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.

Connectez-vous pour commenter.

Réponses (2)

Image Analyst
Image Analyst le 13 Déc 2016
It looks like there are 10 animals in that photo!
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)!

Simone Hernandez
Simone Hernandez le 16 Déc 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. :)

Catégories

En savoir plus sur Animation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by