#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# Calculate Speed of Hand Gesture

edited April 2014 in Kinect

I'm trying to calculate speed of hand gesture from hand tracking. Here's the psuedocode for solving this problem:

``````f1 = get_current_frame_hand_coordinates()
f0 = get_previous_frame_hand_coordinates()
``````

Then I need a function to calculate distance. my input should be two tuples, here a and b, of size three, i.e. (x,y,z)

``````e_distance(a,b):
d = square_root( (a-b)^2 + (a-b)^2 + (a-b)^2 )
return d
``````

`dist = e_distance(f0,f1)` Basically, here it just plug the tuple values into the equation. I'm not sure how your code is laid out, this is designed for a single set of tuples.

Now that I have the distance, then I just need to calculate the speed.

`speed = distance/seconds_per_frame` Wikipedia says that the framerate of a Kinect is between 9 and 30 Hz. This means that your seconds_per_frame is between 1/9 and 1/30 of a second.

anybody who know how to convert that psuedocode become a code ? (i'm using processing 1.5.1 with simpleopenNI 0.27)

`distance_between_hand_in_consecutive_frames/(seconds_per_frame)`