From 484b1f7b0b3a68d9eae8cdb7f4bc2c01fd298a12 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 7 Sep 2022 22:34:12 +0200 Subject: Tracking arcuo before to draw anythong on frame to not disturb dectection. Replacing precision by accuracy. --- .../utils/export_tobii_segment_aruco_visual_scan.py | 16 ++++++++-------- src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py b/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py index 9524f0f..eb317d5 100644 --- a/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py +++ b/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py @@ -193,14 +193,18 @@ def main(): try: # Initialise progress bar - #MiscFeatures.printProgressBar(0, tobii_segment_video.get_duration()/1000, prefix = 'Progress:', suffix = 'Complete', length = 100) + MiscFeatures.printProgressBar(0, tobii_segment_video.get_duration()/1000, prefix = 'Progress:', suffix = 'Complete', length = 100) # Iterate on video frames for video_ts, video_frame in tobii_segment_video.frames(): video_ts_ms = video_ts / 1000 - # write segment timing + # Track markers with pose estimation and draw them + aruco_tracker.track(video_frame.matrix) + aruco_tracker.draw(video_frame.matrix) + + # Write segment timing 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) try: @@ -220,7 +224,7 @@ def main(): tobii_camera_hfov_mm = numpy.sin(numpy.deg2rad(tobii_camera_hfov)) * nearest_gaze_position_3d.value[2] gaze_accuracy_pixel = round(video_frame.width * float(gaze_accuracy_mm) / float(tobii_camera_hfov_mm)) - # Draw gaze position and precision + # Draw gaze position and accuracy cv.circle(video_frame.matrix, gaze_position_pixel, 2, (0, 255, 255), -1) cv.circle(video_frame.matrix, gaze_position_pixel, gaze_accuracy_pixel, (0, 255, 255), 1) @@ -236,10 +240,6 @@ def main(): except ValueError: continue - # Track markers with pose estimation and draw them - aruco_tracker.track(video_frame.matrix) - aruco_tracker.draw(video_frame.matrix) - # Draw focus area cv.circle(video_frame.matrix, (int(video_frame.width/2), int(video_frame.height/2)), int(video_frame.width/3), (255, 150, 150), 1) @@ -323,7 +323,7 @@ def main(): # Update Progress Bar progress = video_ts_ms - int(args.time_range[0] * 1000) - #MiscFeatures.printProgressBar(progress, tobii_segment_video.get_duration()/1000, prefix = 'Progress:', suffix = 'Complete', length = 100) + MiscFeatures.printProgressBar(progress, tobii_segment_video.get_duration()/1000, prefix = 'Progress:', suffix = 'Complete', length = 100) # Exit on 'ctrl+C' interruption except KeyboardInterrupt: diff --git a/src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py b/src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py index 308c1f5..41bd7b5 100644 --- a/src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py +++ b/src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py @@ -97,6 +97,10 @@ def main(): video_ts, video_frame = tobii_video_stream.read() + # Track markers with pose estimation and draw them + aruco_tracker.track(video_frame.matrix) + aruco_tracker.draw(video_frame.matrix) + try: # Read data stream @@ -120,7 +124,7 @@ def main(): tobii_camera_hfov_mm = numpy.sin(numpy.deg2rad(tobii_camera_hfov)) * nearest_gaze_position_3d.value[2] gaze_accuracy_pixel = round(video_frame.width * float(gaze_accuracy_mm) / float(tobii_camera_hfov_mm)) - # Draw gaze position and precision + # Draw gaze position and accuracy cv.circle(video_frame.matrix, gaze_position_pixel, 2, (0, 255, 255), -1) cv.circle(video_frame.matrix, gaze_position_pixel, gaze_accuracy_pixel, (0, 255, 255), 1) @@ -132,10 +136,6 @@ def main(): except (AttributeError, ValueError): continue - # Track markers with pose estimation and draw them - aruco_tracker.track(video_frame.matrix) - aruco_tracker.draw(video_frame.matrix) - # Draw focus area cv.circle(video_frame.matrix, (int(video_frame.width/2), int(video_frame.height/2)), int(video_frame.width/3), (255, 150, 150), 1) -- cgit v1.1