diff options
author | Théo de la Hogue | 2022-04-27 16:59:36 +0200 |
---|---|---|
committer | Théo de la Hogue | 2022-04-27 16:59:36 +0200 |
commit | e910bdfa83f600dd8ed51ec309e8e685f9b9585f (patch) | |
tree | 03a957ba6520388a3a1430c116161a5af185da07 | |
parent | 0eb91d9c3842e4a2e9c7c8847e9054be6685947d (diff) | |
download | argaze-e910bdfa83f600dd8ed51ec309e8e685f9b9585f.zip argaze-e910bdfa83f600dd8ed51ec309e8e685f9b9585f.tar.gz argaze-e910bdfa83f600dd8ed51ec309e8e685f9b9585f.tar.bz2 argaze-e910bdfa83f600dd8ed51ec309e8e685f9b9585f.tar.xz |
Displaying pupil diameter data.
-rw-r--r-- | src/argaze/utils/replay_tobii_session.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/argaze/utils/replay_tobii_session.py b/src/argaze/utils/replay_tobii_session.py index 20607c2..62c2a7e 100644 --- a/src/argaze/utils/replay_tobii_session.py +++ b/src/argaze/utils/replay_tobii_session.py @@ -38,6 +38,10 @@ def main(): tobii_ts_gaze_positions = tobii_segment_data.gidx_l_gp print(f'{len(tobii_ts_gaze_positions)} gaze positions loaded') + # Access to timestamped pupil diameter data buffer + tobii_ts_pupil_diameter = tobii_segment_data.gidx_pd_eye + print(f'{len(tobii_ts_pupil_diameter)} pupil diameters loaded') + # Video and data replay loop try: @@ -50,12 +54,25 @@ def main(): closest_gaze_ts, closest_gaze_position = tobii_ts_gaze_positions.pop_first_until(video_ts) # Draw gaze position - gaze_position = (int(closest_gaze_position.gp[0] * video_frame.width), int(closest_gaze_position.gp[1] * video_frame.height)) + gaze_position = GazeFeatures.GazePosition(int(closest_gaze_position.gp[0] * video_frame.width), int(closest_gaze_position.gp[1] * video_frame.height)) cv.circle(video_frame.matrix, gaze_position.as_tuple(), 4, (0, 255, 255), -1) - + # Wait for gaze position except ValueError: continue + + try: + + # Get closest pupil diameter before video timestamp and remove all pupil diameters before + closest_pupil_ts, closest_pupil_diameter = tobii_ts_pupil_diameter.pop_first_until(video_ts) + + # Draw pupil diameter + pupil_diameter = int(closest_pupil_diameter.pd * 2) + cv.circle(video_frame.matrix, gaze_position.as_tuple(), pupil_diameter, (255, 0, 255), 1) + + # Ignore missing pupil diameter + except ValueError: + pass # Close window using 'Esc' key if cv.waitKey(1) == 27: |