Hello!
I want to use features of rotation, scale, and translation motions.
I am using python 2.7, SDK 4.1.0 in windows 10
def on_frame(self, controller):
frames = controller.frame(3)
last_frame = controller.frame(0)
if last_frame.is_valid:
print "last_frame valid"
if frames.is_valid:
print "frames valid"
# Get frames
for f in range(0, 3):
if frames.hands.is_empty:
print "No hand detected"
break
number_hands = len(frames.hands)
number_fingers = len(frames.fingers)
print "Frame id: %d, timestamp: %dms, hands: %d, fingers: %d " % (
frames.id, frames.timestamp, len(frames.hands), len(frames.fingers))
# Get rotation motion
x_hand_rotation_angle = frames.rotation_angle(last_frame) * Leap.RAD_TO_DEG
print " Rotation Motion: hand rotation angle around the computed rotation axis vector: %f degree" % x_hand_rotation_angle
rotation_probability = frames.rotation_probability(last_frame)
axis_of_hand_rotation = frames.rotation_axis(last_frame)
print " hand rotation probability [0-1]: %f, hand rotation: %s" % (rotation_probability, axis_of_hand_rotation)
# Get scale motion
hand_scale_factor = frames.scale_factor(last_frame)
hand_scale_probability = frames.scale_probability(last_frame)
print " Scale Motion: hand scale factor: %f, scale probability: %f" % (
hand_scale_factor, hand_scale_probability)
# Get translation motion
translation = frames.translation(last_frame)
hand_translation_probability = frames.translation_probability(last_frame)
print " Translation Motion: linear hand movement: %s, translation intent factor: %f" % (translation, hand_translation_probability)
last_frame = frames
# If the controller doesn't detect any frame
if not frames.is_valid:
print "frames NOT valid"
else:
print "last_frame NOT valid"
all frames and hands are valid, but features are all zeros, except rotation angle always equal to 120.000005 and hand scale factor always equal to 1
last_frame valid
frames valid
Frame id: 119233, timestamp: 192217718983ms, hands: 1, fingers: 5
Rotation Motion: hand rotation angle around the computed rotation axis vector: 120.000005 degree
hand rotation probability [0-1]: 0.000000, hand rotation: (0, 0, 0)
Scale Motion: hand scale factor: 1.000000, scale probability: 0.000000
Translation Motion: linear hand movement: (0, 0, 0), translation intent factor: 0.000000
I tried to extract these features from frame object and hand object but I always have the same results, please help me stop moving my hand around the camera for nothing
Thank you so much in advance for your help and suggestions