Skip to content

Commit

Permalink
fine tuned parameters for detecting gestures
Browse files Browse the repository at this point in the history
  • Loading branch information
Zarnack committed Feb 3, 2022
1 parent fc8a5ab commit 2f86aa1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
17 changes: 7 additions & 10 deletions kinect/kinect.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def check_straight_swipe(self, point_series):
n = y1 - m*x1
for point in point_series[1:9]:
y = m*point.x +n
if y/point.y < 0.9 or y/point.y > 1.1:
if y/point.y < 0.85 or y/point.y > 1.15:
print("not in a straight line")
return False
return True
Expand Down Expand Up @@ -323,25 +323,25 @@ def hand_in_area(self, point):
return None
distance = abs(point.x - point.central)
if self.disabled_area == None:
if (distance <= 300):
if (distance <= 250):
return 0
if (distance > 300 and distance <= 500):
if (distance > 250 and distance <= 450):
return 1
if (distance > 500):
if (distance > 450):
return 2
else:
if self.disabled_area == 0:
if (distance <= 400):
if (distance <= 350):
return 1
else:
return 2
if self.disabled_area == 1:
if (distance <= 400):
if (distance <= 350):
return 0
else:
return 2
if self.disabled_area == 2:
if (distance <= 400):
if (distance <= 350):
return 0
else:
return 1
Expand Down Expand Up @@ -409,6 +409,3 @@ def hand_gesture_detected(side, gesture):
kinect_thread = threading.Thread(target=kinect_thread_runner, args=(hand_data,))
kinect_thread.setDaemon(False)
kinect_thread.start()
time.sleep(7)
#get hand data
print(hand_data.get())
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ def kinect_thread_runner(fps, request_status):

if __name__ == '__main__':
kinect_connected = True
simulation = False
done = False
simulation = True

app = QApplication([])
app = global_style.set_style(app)
window = MainWindow(simulation)
if kinect_connected:
done = False
hand_data = Queue(maxsize=1)
kinect_thread = threading.Thread(target=kinect_thread_runner, args=(30, hand_data,))
kinect_thread.setDaemon(False)
Expand All @@ -212,7 +212,7 @@ def kinect_thread_runner(fps, request_status):
timer_gui.timeout.connect(window.update_gui)
timer_gui.start(35)

window.resize(1920, 1080)
window.resize(1750, 1200)
window.show()

timer = QtCore.QTimer()
Expand Down

0 comments on commit 2f86aa1

Please sign in to comment.