aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2022-03-23 09:52:58 +0100
committerThéo de la Hogue2022-03-23 09:52:58 +0100
commit097f3df36d33d2e66d85757fe950b40453f3d307 (patch)
tree4c0e30a48fabfbac567a645af5d61bc33c62d1b4
parent33d2a41d2a092774dfe3afc9a21b52a1ba343fee (diff)
downloadargaze-097f3df36d33d2e66d85757fe950b40453f3d307.zip
argaze-097f3df36d33d2e66d85757fe950b40453f3d307.tar.gz
argaze-097f3df36d33d2e66d85757fe950b40453f3d307.tar.bz2
argaze-097f3df36d33d2e66d85757fe950b40453f3d307.tar.xz
Updating while loop
-rw-r--r--src/argaze/TobiiGlassesPro2/TobiiVideo.py1
-rw-r--r--src/argaze/utils/calibrate_tobii_camera.py11
-rw-r--r--src/argaze/utils/track_aruco_rois_with_tobii_glasses.py9
3 files changed, 10 insertions, 11 deletions
diff --git a/src/argaze/TobiiGlassesPro2/TobiiVideo.py b/src/argaze/TobiiGlassesPro2/TobiiVideo.py
index babc30b..b927b7f 100644
--- a/src/argaze/TobiiGlassesPro2/TobiiVideo.py
+++ b/src/argaze/TobiiGlassesPro2/TobiiVideo.py
@@ -78,7 +78,6 @@ class TobiiVideoThread(threading.Thread):
return frame_copy, width_copy, height_copy, time_copy, pts_copy
-
def read_pts_buffer(self):
"""Get Presentation Time Stamp data buffer."""
diff --git a/src/argaze/utils/calibrate_tobii_camera.py b/src/argaze/utils/calibrate_tobii_camera.py
index c50b499..553632f 100644
--- a/src/argaze/utils/calibrate_tobii_camera.py
+++ b/src/argaze/utils/calibrate_tobii_camera.py
@@ -61,10 +61,11 @@ def main():
expected_markers_number = len(aruco_board.get_ids())
expected_corners_number = (aruco_board.get_size()[0] - 1 ) * (aruco_board.get_size()[1] - 1)
- # running until keyboard interruption
+ # capture loop
try:
- while True:
+ # wait 1ms between each frame until 'Esc' key is pressed
+ while cv.waitKey(1) != 27:
# capture frame with a full displayed board
frame, frame_width, frame_height, frame_time, frame_pts = tobii_video_thread.read()
@@ -88,11 +89,9 @@ def main():
# append data
aruco_camera.store_calibration_data(aruco_tracker.get_board_corners(), aruco_tracker.get_board_corners_ids())
- cv.imshow(f'Tobii Camera Calibration', frame)
+ cv.imshow('Tobii Camera Calibration', frame)
- time.sleep(2)
-
- # exit on keyboard interruption
+ # exit on 'ctrl+C' interruption
except KeyboardInterrupt:
pass
diff --git a/src/argaze/utils/track_aruco_rois_with_tobii_glasses.py b/src/argaze/utils/track_aruco_rois_with_tobii_glasses.py
index 82e25bc..334a6bb 100644
--- a/src/argaze/utils/track_aruco_rois_with_tobii_glasses.py
+++ b/src/argaze/utils/track_aruco_rois_with_tobii_glasses.py
@@ -64,10 +64,11 @@ def main():
roi2D_buffer = []
marker_buffer = []
- # running until keyboard interruption
+ # tracking loop
try:
- while True:
+ # wait 1ms between each frame until 'Esc' key is pressed
+ while cv.waitKey(1) != 27:
frame, frame_width, frame_height, frame_time, pts = tobii_video_thread.read()
@@ -126,9 +127,9 @@ def main():
}
marker_buffer.append(marker)
- cv.imshow(f'Live Scene', frame)
+ cv.imshow('Live Scene', frame)
- # exit on keyboard interruption
+ # exit on 'ctrl+C' interruption
except KeyboardInterrupt:
pass