Одновременное распознавание нескольких жестов с помощью Python Leap Motion - PullRequest
0 голосов
/ 08 сентября 2018

Я использую новейшую библиотеку python для Leap Motion. Я упростил код, чтобы распечатать жесты, сделанные пользователем. Но моя проблема в том, что иногда обнаруживаются множественные жесты. Раздел кода, который я использую:

 for gesture in frame.gestures():     

           if gesture.type == Leap.Gesture.TYPE_CIRCLE:
             circle = CircleGesture(gesture)

            # Determine clock direction using the angle between the pointable and the circle normal
             if circle.pointable.direction.angle_to(circle.normal) <= Leap.PI/2:
                clockwiseness = "clockwise"
                print("%s" %clockwiseness)
             elif circle.pointable.direction.angle_to(circle.normal) > Leap.PI/2:
                clockwiseness = "counterclockwise"
                print("%s" %clockwiseness) 


           if gesture.type == Leap.Gesture.TYPE_SWIPE:

                swipe = SwipeGesture(gesture)            

                if (swipe.direction.x >0 and math.fabs(swipe.direction.x)> math.fabs(swipe.direction.z)):
                        print("right swipe")
                elif (swipe.direction.x <0 and math.fabs(swipe.direction.x)>math.fabs(swipe.direction.z)):
                        print("left swipe")

             #Since the camera will be facing the user, the up and down motion will be characterized by the z co-ordinte
                elif (swipe.direction.z<0 and math.fabs(swipe.direction.z)> math.fabs(swipe.direction.x)):
                        print("up swipe")
                elif (swipe.direction.z>0 and math.fabs(swipe.direction.z)>math.fabs(swipe.direction.x)):
                        print("down swipe")                     

           if gesture.type == Leap.Gesture.TYPE_KEY_TAP:
                keytap = KeyTapGesture(gesture)
                print("Screen Tap")

           if gesture.type == Leap.Gesture.TYPE_SCREEN_TAP:
                screentap = ScreenTapGesture(gesture)
                print("Key Tap")

           if  (frame.hands.is_empty and frame.gestures().is_empty):
                 print("")   

Иногда, когда я проводил, он обнаруживает жесты смахивания и обводки в следующем кадре. Таким образом, выходной сигнал обнаруживает как смахивание, так и обвод, в то время как я только пытаюсь сделать смахивание. Есть ли способ отключить другие распознавания жестов при выполнении одного жеста? Например, отключите круг и прикосновение к экрану во время использования жеста смахивания и наоборот. Я новичок в Leap motion и уже несколько дней пытаюсь найти решение для этого. Я даже попробовал

controller.enable_gesture(Leap.Gesture.TYPE_CIRCLE,false)

чтобы увидеть, работает ли это, но это не так. Любые предложения и помощь будут с благодарностью. Спасибо

...