aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2022-12-11 01:03:33 +0100
committerThéo de la Hogue2022-12-11 01:03:33 +0100
commitd613e1b48b8a6bafd4429055459201f81e7b4f05 (patch)
tree1546bf450855aef8c70f659e3e6acfd9dddea3e6 /src
parent3a1d4028d6fe865abb044ce31c4dc6acd885e045 (diff)
downloadargaze-d613e1b48b8a6bafd4429055459201f81e7b4f05.zip
argaze-d613e1b48b8a6bafd4429055459201f81e7b4f05.tar.gz
argaze-d613e1b48b8a6bafd4429055459201f81e7b4f05.tar.bz2
argaze-d613e1b48b8a6bafd4429055459201f81e7b4f05.tar.xz
Drawing gaze positions on top of gaze status.
Diffstat (limited to 'src')
-rw-r--r--src/argaze/utils/tobii_segment_gaze_movements_export.py33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/argaze/utils/tobii_segment_gaze_movements_export.py b/src/argaze/utils/tobii_segment_gaze_movements_export.py
index 257f875..9fe6c36 100644
--- a/src/argaze/utils/tobii_segment_gaze_movements_export.py
+++ b/src/argaze/utils/tobii_segment_gaze_movements_export.py
@@ -302,8 +302,6 @@ def main():
if unknown_exist:
current_unknown_ts, current_unknown = ts_unknown.pop_first()
- ts_last = 0
-
# Iterate on video frames
for video_ts, video_frame in tobii_segment_video.frames():
@@ -391,20 +389,37 @@ def main():
cv.line(visu_matrix, start_gaze_status, next_gaze_status, movement_color, 3)
cv.line(gaze_status_matrix, start_gaze_status, next_gaze_status, movement_color, 3)
+
+ # Empty gaze position
+ except IndexError:
+ pass
+
+ # Draw all next gaze positions
+ try:
+
+ # Get next gaze position
+ ts_next, next_gaze_position = ts_gaze_positions.first
+
+ # Check next gaze status is not after current time
+ while ts_next <= video_ts:
+
+ ts_start, start_gaze_position = ts_gaze_positions.pop_first()
+ ts_next, next_gaze_position = ts_gaze_positions.first
+
+ if start_gaze_position.valid and next_gaze_position.valid:
- # Draw movement
- cv.line(visu_matrix, start_gaze_status, next_gaze_status, (0, 255, 255), 1)
- cv.line(gaze_status_matrix, start_gaze_status, next_gaze_status, (0, 255, 255), 1)
+ # Draw movement
+ cv.line(visu_matrix, start_gaze_position, next_gaze_position, (0, 255, 255), 1)
+ cv.line(gaze_status_matrix, start_gaze_position, next_gaze_position, (0, 255, 255), 1)
# Draw gaze
- next_gaze_status.draw(visu_matrix)
- next_gaze_status.draw(gaze_status_matrix)
+ next_gaze_position.draw(visu_matrix)
+ next_gaze_position.draw(gaze_status_matrix)
# Write last next gaze status
- if ts_next != ts_last:
+ if next_gaze_position.valid:
cv.putText(visu_matrix, str(next_gaze_status.value), next_gaze_status.value, cv.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv.LINE_AA)
- ts_last = ts_next
# Empty gaze position
except IndexError: