diff options
-rw-r--r-- | src/argaze/utils/export_tobii_segment_movements.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/argaze/utils/export_tobii_segment_movements.py b/src/argaze/utils/export_tobii_segment_movements.py index a36fe58..8ae074a 100644 --- a/src/argaze/utils/export_tobii_segment_movements.py +++ b/src/argaze/utils/export_tobii_segment_movements.py @@ -127,7 +127,10 @@ def main(): MiscFeatures.printProgressBar(0, tobii_segment_video.get_duration()/1000, prefix = 'Video with movements processing:', suffix = 'Complete', length = 100) current_fixation_ts, current_fixation = fixations.pop_first() - time_counter = 0 + current_fixation_time_counter = 0 + + current_saccade_ts, current_saccade = saccades.pop_first() + # Iterate on video frames for video_ts, video_frame in tobii_segment_video.frames(): @@ -141,19 +144,28 @@ def main(): cv.putText(video_frame.matrix, f'Dispersion threshold: {args.dispersion_threshold} px', (20, 100), cv.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 1, cv.LINE_AA) cv.putText(video_frame.matrix, f'Duration threshold: {args.duration_threshold} ms', (20, 140), cv.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 1, cv.LINE_AA) + # Draw current fixation if len(fixations) > 0: if video_ts_ms > current_fixation_ts + current_fixation.duration: current_fixation_ts, current_fixation = fixations.pop_first() - time_counter = 0 + current_fixation_time_counter = 0 + + # Draw saccade + if len(saccades) > 0: + + if video_ts_ms > current_saccade_ts + current_saccade.duration: + + current_saccade_ts, current_saccade = saccades.pop_first() + + cv.line(video_frame.matrix, current_saccade.start_position, current_saccade.end_position, (0, 0, 255), 2) else: - time_counter += 1 + current_fixation_time_counter += 1 - # Draw current fixation - cv.circle(video_frame.matrix, current_fixation.centroid, current_fixation.dispersion + time_counter, (0, 255, 255), 1) + cv.circle(video_frame.matrix, current_fixation.centroid, current_fixation.dispersion + current_fixation_time_counter, (0, 255, 255), 1) try: |