Counting object on image algorithm

一个人想着一个人 提交于 2020-01-13 01:55:01

问题


I got school task again. This time, my teacher gave me task to create algorithm to count how many ducks on picture.

The picture is similar to this one:

I think I should use pattern recognition for searching how many ducks on it. But I don't know which pattern match for each duck.


回答1:


Here's one way:

Hough transform for circles:

  • Initialize an accumulator array indexed by (x,y,radius)
  • For each pixel:
    • calculate an edge (e.g. Sobel operator will provide both magnitude and direction), if magnitude exceeds some threshold then:
      • increment every accumulator for which this edge could possibly lend evidence (only the (x,y) in the direction of the edge, only radii between min_duck_radius and max_duck_radius)
  • Now smooth and threshold the accumulator array, and the coordinates of highest accumulators show you where the heads are. The threshold may leap out at you if you histogram the values in the accumulators (there may be a clear difference between "lots of evidence" and "noise").

So that's very terse, but it can get you started.




回答2:


I think that you can solve this problem by segmenting the ducks' beaks and counting the number of connected components in the binary image.

To segment the ducks' beaks, first convert the image to HSV color space and then perform a binarization using the hue component. Note that the ducks' beaks hue are different from other parts of the image.




回答3:


It might be just because I'm working with SIFT right now, but to me it looks like it could be good for your problem.

It is an algorithm that matches the same object on two different pictures, where the objects can have different orientations, scales and be viewed from different perspectives on the two pictures. It can also work when an object is partially hidden (as your ducks are) by another object.

I'd suggest finding a good clear picture of a rubber ducky ( :D ) and then use some SIFT implementation (VLFeat - C library with SIFT but no visualization, SIFT++ - based on VLFeat, but in C++ , Rob Hess in C with OpenCV...).

You should bear in mind that matching with SIFT (and anything else) is not perfect - so you might not get the exact number of rubber duckies in the picture.



来源:https://stackoverflow.com/questions/8644600/counting-object-on-image-algorithm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!