diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/utils/tobii_segment_gaze_movements_export.py | 33 |
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: |