aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/utils/tobii_segment_gaze_movements_export.py18
1 files changed, 9 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 d52b08b..36e937f 100644
--- a/src/argaze/utils/tobii_segment_gaze_movements_export.py
+++ b/src/argaze/utils/tobii_segment_gaze_movements_export.py
@@ -66,7 +66,7 @@ def main():
# Load a tobii segment video
tobii_segment_video = tobii_segment.load_video()
- print(f'Video properties:\n\tduration: {tobii_segment_video.get_duration()/1e6} s\n\twidth: {tobii_segment_video.get_width()} px\n\theight: {tobii_segment_video.get_height()} px')
+ print(f'Video properties:\n\tduration: {tobii_segment_video.duration/1e6} s\n\twidth: {tobii_segment_video.width} px\n\theight: {tobii_segment_video.height} px')
# Load a tobii segment data
tobii_segment_data = tobii_segment.load_data()
@@ -89,7 +89,7 @@ def main():
# Test gaze position validity
if tobii_gaze_position.validity == 0:
- gaze_position_pixel = GazeFeatures.GazePosition( (int(tobii_gaze_position.value[0] * tobii_segment_video.get_width()), int(tobii_gaze_position.value[1] * tobii_segment_video.get_height())) )
+ gaze_position_pixel = GazeFeatures.GazePosition( (int(tobii_gaze_position.value[0] * tobii_segment_video.width), int(tobii_gaze_position.value[1] * tobii_segment_video.height)) )
# Get gaze position 3D at same gaze position timestamp
tobii_gaze_position_3d = tobii_ts_gaze_positions_3d.pop(ts)
@@ -100,7 +100,7 @@ def main():
gaze_accuracy_mm = numpy.sin(numpy.deg2rad(TobiiSpecifications.ACCURACY)) * tobii_gaze_position_3d.value[2]
tobii_camera_hfov_mm = numpy.sin(numpy.deg2rad(TobiiSpecifications.CAMERA_HFOV)) * tobii_gaze_position_3d.value[2]
- gaze_position_pixel.accuracy = round(tobii_segment_video.get_width() * float(gaze_accuracy_mm) / float(tobii_camera_hfov_mm))
+ gaze_position_pixel.accuracy = round(tobii_segment_video.width * float(gaze_accuracy_mm) / float(tobii_camera_hfov_mm))
# Store gaze position using millisecond unit timestamp
ts_gaze_positions[ts/1e3] = gaze_position_pixel
@@ -121,7 +121,7 @@ def main():
gaze_status = GazeFeatures.TimeStampedGazeStatus()
# Initialise progress bar
- MiscFeatures.printProgressBar(0, int(tobii_segment_video.get_duration()/1e3), prefix = 'Movements identification:', suffix = 'Complete', length = 100)
+ MiscFeatures.printProgressBar(0, int(tobii_segment_video.duration/1e3), prefix = 'Movements identification:', suffix = 'Complete', length = 100)
for item in movement_identifier:
@@ -150,7 +150,7 @@ def main():
# Update Progress Bar
progress = ts - int(args.time_range[0] * 1e3)
- MiscFeatures.printProgressBar(progress, int(tobii_segment_video.get_duration()/1e3), prefix = 'Movements identification:', suffix = 'Complete', length = 100)
+ MiscFeatures.printProgressBar(progress, int(tobii_segment_video.duration/1e3), prefix = 'Movements identification:', suffix = 'Complete', length = 100)
print(f'\n{len(fixations)} fixations and {len(saccades)} saccades found')
@@ -167,13 +167,13 @@ def main():
print(f'Gaze status saved into {gaze_status_filepath}')
# Prepare video exportation at the same format than segment video
- output_video = TobiiVideo.TobiiVideoOutput(gaze_status_video_filepath, tobii_segment_video.get_stream())
+ output_video = TobiiVideo.TobiiVideoOutput(gaze_status_video_filepath, tobii_segment_video.stream)
# Video and data loop
try:
# Initialise progress bar
- MiscFeatures.printProgressBar(0, tobii_segment_video.get_duration()/1e3, prefix = 'Video with movements processing:', suffix = 'Complete', length = 100)
+ MiscFeatures.printProgressBar(0, tobii_segment_video.duration/1e3, prefix = 'Video with movements processing:', suffix = 'Complete', length = 100)
current_fixation_ts, current_fixation = fixations.pop_first()
current_fixation_time_counter = 0
@@ -238,14 +238,14 @@ def main():
break
# Display video
- cv.imshow(f'Segment {tobii_segment.get_id()} movements', video_frame.matrix)
+ cv.imshow(f'Segment {tobii_segment.id} movements', video_frame.matrix)
# Write video
output_video.write(video_frame.matrix)
# Update Progress Bar
progress = video_ts_ms - int(args.time_range[0] * 1e3)
- MiscFeatures.printProgressBar(progress, tobii_segment_video.get_duration()/1e3, prefix = 'Video with movements processing:', suffix = 'Complete', length = 100)
+ MiscFeatures.printProgressBar(progress, tobii_segment_video.duration/1e3, prefix = 'Video with movements processing:', suffix = 'Complete', length = 100)
# Exit on 'ctrl+C' interruption
except KeyboardInterrupt: