From ff74c08b26885c87fea932bc808ff877604aa0fd Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Fri, 9 Dec 2022 23:59:51 +0100 Subject: Displaying gaze positions belonging to fixations. --- .../utils/tobii_segment_gaze_movements_export.py | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/argaze/utils/tobii_segment_gaze_movements_export.py b/src/argaze/utils/tobii_segment_gaze_movements_export.py index 7e184ee..1b38fd9 100644 --- a/src/argaze/utils/tobii_segment_gaze_movements_export.py +++ b/src/argaze/utils/tobii_segment_gaze_movements_export.py @@ -383,6 +383,31 @@ def main(): current_fixation_time_counter += 1 + # Draw all fixation gaze positions + try: + + # Get next fixation position + ts_next, _ = current_fixation.positions.first + + # Check next fixation positions is not after current time + while ts_next < video_ts: + + ts_start, start_gaze_position = current_fixation.positions.pop_first() + ts_next, next_gaze_position = current_fixation.positions.first + + # Draw movement + if start_gaze_position.valid and next_gaze_position.valid: + + int_start_position = (int(start_gaze_position[0]), int(start_gaze_position[1])) + int_next_position = (int(next_gaze_position[0]), int(next_gaze_position[1])) + + cv.line(visu_matrix, int_start_position, int_next_position, (0, 255, 0), 3) + cv.line(heatmap_matrix, int_start_position, int_next_position, (0, 255, 0), 3) + + # Empty gaze position + except IndexError: + pass + # Draw current fixation cv.circle(visu_matrix, (int(current_fixation.centroid[0]), int(current_fixation.centroid[1])), int(current_fixation.dispersion), (0, 255, 0), current_fixation_time_counter) cv.circle(heatmap_matrix, (int(current_fixation.centroid[0]), int(current_fixation.centroid[1])), int(current_fixation.dispersion), (0, 255, 0)) @@ -403,7 +428,7 @@ def main(): # Get next saccade position ts_next, _ = current_saccade.positions.first - # Check next unknown positions is not after current time + # Check next saccade positions is not after current time while ts_next < video_ts: ts_start, start_gaze_position = current_saccade.positions.pop_first() -- cgit v1.1