In video analysis I have been working with what is often referred to as “quantity of motion” (which should not be confused with momentum, the product of mass and velocity p=mv), i.e. the sum of all active pixels in a motion image. In this sense, QoM is 0 if there is no motion, and has a positive value if there is motion in any direction.
Working with various types of sensor and motion capture systems, I see the same need to know how much motion there is in the system, independent of the number of variables and dimensions in the system studied. Thus, whether we use a single 1-dimensional MIDI slider or 32 6-dimensional sensors in a motion capture system, we still need to be able to say whether there is any movement in the system, and approximately how much movement there is.
So I have made a small abstraction in Max that sums up all incoming values, divides by the number of values, finds the first derivative and takes the absolute value of this.
I had two optimization questions while working on the patch:
- Does it matter whether derivation is done before or after summing up the values?
- Is it more efficient to use Max objects than Jitter objects?
Answers:
- No, it does not matter.
- Max objects are ~3 times faster
A screenshot of the efficiency test patch is shown below, and a zip-file of the patches.