A while ago, I wrote some code to perform 2d optical flow on a sequence of images. The goal was to track a series of cars across a road, and determine how fast each of them were driving. You can see the original image, and some of the result images in the links below. Unfortunently, I lost the source code, so its not available here. I later developed a better vehicle tracking system that uses a simpler algorithm that seems to work better.
In the examples above, the car being tracked is indicated by the red rectangle, which was manually initialized by selecting points on the first frame. The optical flow tracker is able to follow the car across frames, although the gradual accumulation of error causes the rectangle to slide slightly off the car.