This is a 'simple' OpenCV based people counter using background sustraction and image processing. Beware because this will not work with your video frame (it will not detect people well or will not detect it). That is because the code is very tweaked.
For better solutions please use a deep learning based SSD (Single Shot Detectors) like YOLO, Mask-RCNN and so on.
There are two files:
- cvPeopleCounter.py - The main file
- imutils.py - A helper file for resize and other basic functions
- Intel Core i5-4210U CPU @ 1.7GHz
- Windows 8.1 Pro 64-bits
- python 3.6.4
- OpenCV 3.4.1
It expects a video input, but if no video is specified as input it uses the local camera.
$ python cvPeopleCounter.py -v <path_to_video> &
Below is a GIF of some frames demonstrating the usage
License
Disclaimer: Use it at your own risk!