I'm surprised no one got to you in a year. I just came by this by chance. Nice code. Very interesting approach. If you haven't already, you should take a look at the optical flow sketch by Hidetoshi Simodaira it very neatly demonstrates how to use bit shifting to get diffs in rgb values to detect movement, flow etc. It's a trip. I spent a couple years mastering the technique. Though my thunder was all stolen by the Kinect hacking story. I do plan to release something based upon optical flow, some day.
Enjoy,
in the comments of the sketch I left a link to the version I "tweaked" to make it run under 2.0x.
Sid