Median Flow Tracker with Haar Cascades

I am currently working as a research intern in Bangalore pursuing my bachelor thesis. I have been here for the past 2 months working with the Computer Vision Group on a project they had started .Its been a great experience so far and I felt I should update the blog with the work that I’ve been doing.

An important  part of my project is to track multiple users with good amount of accuracy. I have tried using median flow tracker with good results.The main problem has been the fact that fast/random motions tend to destroy the box. So I have used Haar Cascades to detect faces and then use the resulting Box as the input to Median Flow tracker. And anytime the box gets destroyed , haar cascade is run on the image again and MFT runs afresh on the new Box.

I have also added multiple user tracking( currently only 2 people can be tracked ).The project can be downloaded from . Have a look at the readme.txt before running the code. The 51st line of the code might have to be changed depending upon the place you have haarcascade_frontalface_alt.xml in you file system.

Here is a video of the results I had when I ran the code myself.(

Currently,as an improvement I am trying to implement the Condensation Algorithm on the points the MFT returns. The results seem to be better than what I had when I used Kalman Filter. The results of the tracking with that are here. .

Lot of work still to be done. I am currently  learning the OpenNI framework to work with Asus Xtion Pro Live ( A barebone version of the Kinect developed specifically for Robotics application). I want to port all these into kinect. Kinect itself has awesome tracking capabilities but it too is lacking in a few areas(mainly the fact that it uses only depth image to track a human or what it thinks is a human). The tracking mechanism has to be integrated with the project that is going on in research institute.I guess all of this should keep me busy for a while. 🙂


About ranjanritesh

I am currently working as a Software Engineer for Cisco Systems India in Bangalore. I’ve been working for Cisco since August 2013. I am a BITS Goa Alumni. I earned my Bachelors in Electronics and Instrumentation in August 2013 from there. My interests include Image Processing, Systems Programming and hacking on the Linux Kernel. I also like tinker a bit with Arduino and other microcontrollers.
This entry was posted in Open Source, OpenCV and tagged , , . Bookmark the permalink.

3 Responses to Median Flow Tracker with Haar Cascades

  1. Pingback: Lucas Kanade Tracker on MotoGP | Jay Rambhia

  2. richard says:


    Very impressive work!
    Could please share the improvement Condensation Algorithm with me?
    Thanks a lot.


    • ranjanritesh says:

      Hi Richard,

      Thanks. And I am really sorry for such a *HUGE* delay in replying. Was caught up with some work. Anyways, for what it’s worth, I made a gist of the new code. Have a look. Sadly, it doesn’t seem to work too well.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s