Skip to content

Commit d394aca

Browse files
authored
Merge pull request #24 from enricobu96/feature/integrate-gestureassistant-kinect
integrato gesture assistant in run kinect
2 parents 6472ea9 + 932b57d commit d394aca

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

model/kinect_depth/run_kinect.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
import cv2
66
import numpy as np
77
import pandas as pd
8+
import signal
9+
from classes.gesture_assistant import GestureAssistant
10+
import zmq
11+
12+
signal.signal(signal.SIGINT, signal.SIG_DFL)
813

914
class RunKinect:
1015

@@ -46,6 +51,15 @@ def run(self, classificationModel: str):
4651
win_w = 640
4752
win_h = int(img_h * win_w / img_w)
4853

54+
"""
55+
GESTURE PUBLISHER
56+
Gesture publisher for Google Assistant
57+
"""
58+
context = zmq.Context()
59+
socket = context.socket(zmq.PUB)
60+
socket.bind('tcp://*:6969')
61+
g_ass = GestureAssistant(5, 60, 20, 0.8, True)
62+
4963
while True:
5064
# Get frame
5165
ut_frame = user_tracker.read_frame()
@@ -92,6 +106,10 @@ def run(self, classificationModel: str):
92106
cv2.putText(img, 'PROB', (15,12), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 1, cv2.LINE_AA)
93107
cv2.putText(img, str(round(gesture_prob[np.argmax(gesture_prob)],2)), (10,40), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
94108

109+
if g_ass.addToBufferAndCheck(gesture_class, gesture_prob[np.argmax(gesture_prob)]):
110+
print("sending..")
111+
socket.send(bytes(gesture_class,'utf-8')) #(byte?)
112+
95113
print(gesture_class, gesture_prob)
96114

97115

0 commit comments

Comments
 (0)