Update composite_gestures.py
Browse files- composite_gestures.py +11 -26
composite_gestures.py
CHANGED
|
@@ -1,31 +1,16 @@
|
|
| 1 |
# composite_gestures.py
|
| 2 |
-
#
|
| 3 |
|
| 4 |
-
from micro_gestures import
|
| 5 |
|
| 6 |
def detect_composite_gesture(sequence):
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
"""
|
| 11 |
-
|
| 12 |
-
if sequence == ["
|
| 13 |
-
return "
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
if sequence == ["index_pointing_up", "thumb_up"]:
|
| 17 |
-
return "like_and_point"
|
| 18 |
-
|
| 19 |
-
# ok_then_thumb_up: ok sign followed by thumb up
|
| 20 |
-
if sequence == ["ok_sign", "thumb_up"]:
|
| 21 |
-
return "ok_then_like"
|
| 22 |
-
|
| 23 |
-
# fist_then_palm: fist closed then open hand
|
| 24 |
-
if sequence == ["fist_closed", "palm_open", "fist_closed"]:
|
| 25 |
-
return "greeting"
|
| 26 |
-
|
| 27 |
-
# point_then_thumb_down: index pointing then thumb down
|
| 28 |
-
if sequence == ["index_pointing_up", "thumb_down"]:
|
| 29 |
-
return "disapprove"
|
| 30 |
-
|
| 31 |
return None
|
|
|
|
| 1 |
# composite_gestures.py
|
| 2 |
+
# routines for detecting composite gestures from sequences of micro-gestures
|
| 3 |
|
| 4 |
+
from micro_gestures import fist_closed, palm_open, index_pointing_up, thumb_up
|
| 5 |
|
| 6 |
def detect_composite_gesture(sequence):
|
| 7 |
+
# detects a composite gesture from a list of micro-gesture labels
|
| 8 |
+
if sequence == ["palm_open"]:
|
| 9 |
+
return "hello" # open hand wave
|
| 10 |
+
if sequence == ["palm_open", "index_pointing_up", "palm_open"]:
|
| 11 |
+
return "goodbye"
|
| 12 |
+
if sequence == ["thumb_up"]:
|
| 13 |
+
return "yes"
|
| 14 |
+
if sequence == ["index_pointing_up"]:
|
| 15 |
+
return "no"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
return None
|