Search code examples
opencvcomputer-visionvideo-capture

Know how many people are on a video


So there it is, I want to get a camera video stream from a server, and be able to know how many people appear on it.

I can install any OS (MAC, Windows, Linux) on my server, use any API (free or paid) and any language (C++, php etc.) to do so.

I already found some interesting things, such as OpenCV but I think it's more useful for face recognizing than to know the number of people in a room...

Any help would be appreciated :)


Solution

  • Use a human detector applied on each frame for basic statistic exports:

    OpenCV has one already:

    http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html

    All you have to do is replace the face model with a human body (_fullbody.xml):

    https://github.com/Itseez/opencv/tree/master/data/haarcascades

    You can now export some statistics such as how many people per frame there are. To find how many unique individuals appeared in a sequence, you'll need a tracker. From there things get more difficult. You'll have to find something that suits your case. Tip: google for "multi-target tracking code" or similar.