In touchdesigner there is an operator called Slope. "The Slope CHOP calculates the slope (or "derivative" in math-speak) of the input channels.
If the input CHOP represents position, the slope can be interpreted as speed. By default, the Slope CHOP converts position to speed.
In mathematical terms, the slope is the first derivative of the channel curve. The second and third derivatives can also be calculated. The second derivative can be interpreted as acceleration (and the third derivative could be interpreted as the rate of change in acceleration)."
Its handy for using the output as vectors assigned by neighboring pixel colors