From bbba702d02a21b74f9756561befaaeeafbe19515 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 21 Sep 2022 15:58:13 +0200 Subject: Using GazePosition draw method. --- src/argaze/utils/tobii_segment_display.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/argaze/utils/tobii_segment_display.py b/src/argaze/utils/tobii_segment_display.py index a106e7b..604ebcf 100644 --- a/src/argaze/utils/tobii_segment_display.py +++ b/src/argaze/utils/tobii_segment_display.py @@ -94,9 +94,6 @@ def main(): gaze_position_pixel = GazeFeatures.GazePosition( (int(nearest_gaze_position.value[0] * video_frame.width), int(nearest_gaze_position.value[1] * video_frame.height)) ) - # Draw gaze position - cv.circle(video_frame.matrix, gaze_position_pixel, 2, (0, 255, 255), -1) - # Get nearest gaze position 3D before video timestamp and remove all gaze positions before _, nearest_gaze_position_3d = tobii_ts_gaze_positions_3d.pop_first_until(video_ts) @@ -108,9 +105,9 @@ def main(): gaze_position_pixel.accuracy = round(video_frame.width * float(gaze_accuracy_mm) / float(tobii_camera_hfov_mm)) - # Draw gaze accuracy - cv.circle(video_frame.matrix, gaze_position_pixel, gaze_position_pixel.accuracy, (0, 255, 255), 1) - + # Draw gaze + gaze_position_pixel.draw(video_frame.matrix) + # Wait for gaze position except ValueError: pass @@ -138,13 +135,11 @@ def main(): cv.rectangle(video_frame.matrix, (0, 0), (550, 50), (63, 63, 63), -1) cv.putText(video_frame.matrix, f'Segment time: {int(video_ts_ms)} ms', (20, 40), cv.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 1, cv.LINE_AA) - if args.window: - - # Close window using 'Esc' key - if cv.waitKey(1) == 27: - break + # Close window using 'Esc' key + if cv.waitKey(1) == 27: + break - cv.imshow(f'Segment {tobii_segment.get_id()} video', video_frame.matrix) + cv.imshow(f'Segment {tobii_segment.get_id()} video', video_frame.matrix) # Update Progress Bar progress = video_ts_ms - int(args.time_range[0] * 1e3) -- cgit v1.1