I’m deriving velocities from an LK Optical Flow calculation at each side of the screen. Right now it’s working, but the frame to frame differences is a but jittery so the object I’m pushing around with the derived velocity is jittery as well.
Is there a way to smooth the curve, like a running average or something, before applying it to the object?
You can use interpolation. Say you you currently have x1 and the new value is x2. To get a smoother movement the formula would be:
x1 += (x2-x1)*A
A is a value between 0 and 1 and controls the speed of how fast x1 will be x2. Something around .2 usually works alright…
Thanks! That helps a lot.
I’m going to dig a little in my optical flow to see if I can get a better input signal as well.