Please identify how many animals are in the provided image,

3 ビュー (過去 30 日間)
Mike Jordan
Mike Jordan 2016 年 12 月 13 日
コメント済み: Image Analyst 2016 年 12 月 17 日
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 件のコメント
Walter Roberson
Walter Roberson 2016 年 12 月 16 日
... Did an attached image get dropped, or did the image never get attached?
Image Analyst
Image Analyst 2016 年 12 月 17 日
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.

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2016 年 12 月 13 日
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 2016 年 12 月 16 日
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. :)

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by