Motion Tracking

    Jul 20 2009 | 7:47 pm
    I have spent quite a bit of time thinking of and conceptualizing ways to motion track for gallery installations. In the past, I've used sensors, a theremin, etc. but this time my goal was to create a reliable, bullet-proof motion tracking system for an installation where I will not be able to help install.
    The challenge is to get fairly good data, no matter what kind of lighting conditions, number of people etc. - without a complex set up. I experimented with the cv.jit objects, which I think could work but require some set up. The centroids.blob could work, but the tracking jumps around erratically depending on the lighting and what is being seen.
    I finally settled on simple frame differencing, based on Andrew's Hold Still patch. I simply divided the capture into 4 vertical slices and use that to track overall left to right movement. It seems to work pretty reliably, especially for my application which will be to pipe this data into a gaming engine.
    The only requirement is that the camera be in a stable position pointing at the viewer/room. There may be a slight threshold adjustment needed, but so far this works as is in many lighting situations.
    I thought I would share my patch and see if anyone had suggestions for improvement or even simpler approaches. Eventually I will scale this up to 10 slices to see if I get slightly smoother movements. I would be interested in suggestions on how to smooth the end data, which is simply a mean of the last 12 triggered slices. Or, advice on simply how to make the code more elegant!
    It seems a little cludgy, with 4 jit.3m objects, but it does work well.
    (Let me know if there is a better way to post a Max 5 patch, this is a copy as compressed code...)