Helper code used with Michael Black's Robust optical flow code