1. Yves Quemener
  2. HeadCounter

Wiki

Clone wiki

HeadCounter / Home

Head Counter

The aim of this software is to be able to count the number of people present in a crowd, especially in protests, and provide an estimate as accurate as possible. This software is currently at a very early stage.

Results so far

Example image

Result video

Note : The result video does not reflect the speed of the algorithm at all ! The algorithm is a lot slower right now but there is a lot of room for improvement there.

Compilation

You need OpenCV to compile this software (that means the packages libcv-dev and libhighgui-dev). I am trying to keep it in sync with the latest ubuntu stable distribution. It should work well with debian as well. It supposes the include files are in /usr/include/opencv and the libs in /usr/lib. The Makefile is very straightforward to change. Once done, simply typing :

make

should compile both cvplayer and headcounter.

cvplayer is a simple test utility to check that your opencv configuration manage to read a specific file

headcounter is the main program. headcounter -h gives you instruction on how to use it.

Test videos

Here is a complete movie of a protest that happened in Lyon (France) on 2010-10-04. Only 720p but hopefully the next one will have better quality :

torrent link

I also used a cropped version of the "crowd_run" video available there : http://media.xiph.org/video/derf/ Cropped version : http://quemener.yves.free.fr/projects/headcounter/Marathon_crop.avi (267 MB)

I have been unable to find another good example file of a crowd where faces are visible and not too small. Please do not hesitate to contact me if you have such files you are willing to share !

Design notes

I am using openCV's face detector (haar cascade classifier with the cascade file included in opencv) to detect faces. From there I associate close faces on successive frames in order to uniquely count individuals. There are several drawbacks on this implementation : - it is slow - it needs a face that is at least 20 pixels wide - it works only for people really facing the camera (no profiles) - it works bad with caps, hair covering a big part of the face, glasses... - it can count multiple time a single person that gets temporarily hidden behind someone else.

Leads to explore

  • Possibility of creating a cascade file that would work for smaller faces ? It sounds like it would be feasible. The file given with openCV is optimized for the tracking of a single person face, on a webcam. The 20 pixels size is probably more a choice than a hard limit.
  • Possibility of optimizing the haar detector to make it closer to real-time performances ? I have seen some detectors running a lot faster than this one. There may be room for improvement.
  • A completely different algorithm could look at interest points and optical flow. It would cluster the points moving in a coordinated fashion and try to differentiate individuals this way. This can probably work exaggeratedly well for the marathon video, as the runners shirt have a lot of interest points. It would be interesting to test on a more compact crowd.

Support

You can contact me at quemener dot yves at free dot fr.

Updated