aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2022-05-10 11:57:58 +0200
committerThéo de la Hogue2022-05-10 11:57:58 +0200
commitca624af9d6f590e64c70a60ce2fc65f3a755ff2d (patch)
tree4ff25616cb761b8075f4a6d11db40f42383374c7
parentf59fae48f03fc29b315b9ea750c01e147697e3ff (diff)
downloadargaze-ca624af9d6f590e64c70a60ce2fc65f3a755ff2d.zip
argaze-ca624af9d6f590e64c70a60ce2fc65f3a755ff2d.tar.gz
argaze-ca624af9d6f590e64c70a60ce2fc65f3a755ff2d.tar.bz2
argaze-ca624af9d6f590e64c70a60ce2fc65f3a755ff2d.tar.xz
Drawing saccades into movements.mp4 video
-rw-r--r--src/argaze/utils/export_tobii_segment_movements.py22
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: