calculate speed of changing floats & detect activity

fluxus's icon

Hi,
i have built a patch (jit) to detect direction of movement in front of
a camera (with cv.jit.lkflow).
now i want to calculate the energy/speed of motion.
x=s(t)/t
s = [(last float value)-(first float value)]* (-1)
t= (time of last float value) - (time of first float value)
is anybody good at math? ( :

i need to know:
> when does movement start/ end (by a threshold time gap between float/bang(?) )
> time in between

objects that i have reviewed:
counter, timer

i don't get it.. ) :
Probably there is another way to solve this problem, but I'm too stupid!

Max Patch
Copy patch and select New From Clipboard in Max.

thank you
greetings

Owen Green's icon

Hi Fluxus,

You probably don't need the time if you've got a reasonably consistent frame rate.

Rather than multiply your difference by -1, consider just taking the absolute value instead: [abs 0.]

hth

fluxus's icon

yeah, that's a good idea!
thank you.
do you know a object that stores the values in a way, that the operations can be processed?