Has anyone ever 开发者_运维百科tried doing this kinda job?
Before trying to count the number of people in an image, it is easier to first solve the decision problem of: does this region contain a person? And, it is even simpler if you reduce it to a specific size: does this 20x20 pixel image contain a person? It's even easier, if you only strive for detecting faces.. in which case you can use the Viola-Jones face detection algorithm to determine if there is a face in the image.
Once you can say yes/no there is or is not a person (or face) in a region, you can use a sliding-window approach to cover each possible region and say yes/no there is/isn't a person (or face) in that region. To count the number of people (or faces), you simply tally the number of yes responses.
As I've already stated, detecting faces is a little bit easier than detecting people, and detecting front-facing faces is easier than detecting faces in any orientation. That said, it is possible to create object detectors for pretty much any object provided that you have a large enough dataset. These techniques can be fairly accurate, but they aren't 100% reliable, so you will get false positives and false negatives.
You can find a Matlab face detector at the given link.
There's an active community of research into this problem. Here's a good start:
http://lear.inrialpes.fr/people/triggs/pubs/Dalal-cvpr05.pdf
More info an links to implementations of HOG:
http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients
精彩评论