python 2.7 - finger position using leap motion -
i want use leap motion index finger tip position in space ( 3d position x,y,z ) , how can in leap motion ?
this detect index finger, there error :
def on_frame(self, controller): # recent frame , report basic information frame = controller.frame() finger = finger.type_index print('type : '+finger.type()) time.sleep(3)
i leap motion beginner, want guide me how that, , if there examples or codes ?
thanks :)
first off, have @ documentation leap motion python api. examine sample.py program in sdk samples folder. sample.py provides example getting every piece of information available api.
for specific problem above, finger.type_index
gives enumeration or name index finger; not give instance of object representing index finger -- there's index finger each of hands , there can multiple hands in leap device's field of view -- index finger should return?
you can list of tracked fingers frame.fingers()
, list of tracked fingers particular hand hand.fingers()
. these lists, can filter particular type of finger using name (i.e. finger.type_index
or type_thumb
).
def on_frame(self, controller): # recent frame , report basic information frame = controller.frame() fingers = frame.fingers() index_fingers = fingers.finger_type(finger.type_index) for(finger in index_fingers): print('type : '+finger.type()) time.sleep(3)
Comments
Post a Comment