We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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[0]-b[0])^2 + (a[1]-b[1])^2 + (a[2]-b[2])^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)
Thanks you for your attention
Answers
Speed is distance per unit time. Therefore, speed is:
distance_between_hand_in_consecutive_frames/(seconds_per_frame)
To find distance in 3d, i want to use Euclidean distance with the position of the hand in consecutive frames.