Tag Archives: opencv

Tracking people from webcam with OpenCV

Spent last weekend on #douhack (in Donetsk), I have been creating a program to count number of people walking through the street in front of web camera.

This appeared not such a simple task. To recognize moving objects I have used simple technique of background subtraction, when later frame with image capture from camera is subtracted pixel-by-pixel from previous image and revealing the regions which were moved from one frame to another.

More advanced algorithm described in documentation (see referenced works).

For tracking the person which moves I have tried a few techniques, camshift algorithm didn’t really helped. The reason for this is that algorithms doesn’t have enough “memory” capacity to track objects which are disappeared behind the other objects on the street. So I did a hack to linearize the movement of the person to estimate where moved object will appear again.

Here is demo how it works (pretty lame anyway):


Also Github link with sources:


I strongly recommend this book to understand the basics of OpenCV and objects tracking (if pdf is not available – give me a shot and I will update link).

Big special thanks to  Mateusz Stankiewicz for his blog post regarding the topic.

Finger recognition with processing and OpenCV

Still under impression after sleepless night of @24hackathon. I’ve did processing application which does object recognition of fingers (yes, similar to Leap Motion, but much more primitive – you need to use colored caps on fingers so application could track them by color).

Here is gthub link:


And demo (no sound):


Thanks to OpenCV framework – without it I would never complete this. I did game wirh tracking movenent of finger with web cam.

I will create a post on how exactly I have implemented this. Stay tuned.