Step Four - Pseudo Physical Modelling
Step four is really more like a hack, but then again it seems like
a lot of the stuff in computer vision seems to be that way. I noticed
I was losing the ball when it was moving too quickly for the Lucas Kanade
algorithm to track. Thus, I decided to try to implement a simple
motion estimator that assumed the ball was moving at a constant speed in
the same direction. Thus if the ball had moved x units in the previous
frame, the program would assume that the ball had moved x units again in
the same direction and it would look there for it.
It turned out to be not really that simple. As this outtake
in test2 shows, blindly following this could
lead to trouble. Through experimentation, I determined a simple heuristic
that could be used to decide whether or not to use this motion predictor.
Esentially, if the ball moved more than a certain
distance, then the algorithm would be employed. If it did not move by this
amount, then no adjustment would be made and the tracking would begin by
the amount from before. This would prevent the random noise and the natural
jitter of the tracker from perturbing its motion and leading to runaway behavior as
seen in the film.
For the sake of reference, I found the optimal cutoff distance to be 38 pixels.
Now let's take a brief look at the Lucas Kanade portion of the algorithm in the next section.