aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/utils/live_tobii_session.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/argaze/utils/live_tobii_session.py b/src/argaze/utils/live_tobii_session.py
index d4a89b8..7226860 100644
--- a/src/argaze/utils/live_tobii_session.py
+++ b/src/argaze/utils/live_tobii_session.py
@@ -3,7 +3,7 @@
import argparse
import os, time
-from argaze import GazeFeatures, DataStructures
+from argaze import DataStructures
from argaze.TobiiGlassesPro2 import *
import cv2 as cv
@@ -50,18 +50,10 @@ def main():
data_stream = tobii_data_stream.read()
# Store received gaze positions
- for ts in list(data_stream.gidx_l_gp.keys()):
- past_gaze_positions[ts] = data_stream.gidx_l_gp.pop(ts)
+ past_gaze_positions.append(data_stream.gidx_l_gp)
- # Get last gaze position timestamp before video timestamp
- earliest_ts = past_gaze_positions.get_last_before(video_ts)
-
- # When no timestamped gaze position have been found
- if earliest_ts == None:
- raise ValueError
-
- # Get last gaze position value and remove all former gaze positions
- earliest_ts, earliest_gaze_position = past_gaze_positions.pop_first_until(earliest_ts)
+ # Get last gaze position before video timestamp and remove all former gaze positions
+ earliest_ts, earliest_gaze_position = past_gaze_positions.pop_first_until(video_ts)
# Draw video synchronized gaze pointer
pointer = (int(earliest_gaze_position.gp[0] * video_frame.width), int(earliest_gaze_position.gp[1] * video_frame.height))