aboutsummaryrefslogtreecommitdiff
path: root/src/argaze/utils/tobii_stream_aruco_aoi_display.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze/utils/tobii_stream_aruco_aoi_display.py')
-rw-r--r--src/argaze/utils/tobii_stream_aruco_aoi_display.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/argaze/utils/tobii_stream_aruco_aoi_display.py b/src/argaze/utils/tobii_stream_aruco_aoi_display.py
index 77f3c7b..dbe1c5f 100644
--- a/src/argaze/utils/tobii_stream_aruco_aoi_display.py
+++ b/src/argaze/utils/tobii_stream_aruco_aoi_display.py
@@ -24,7 +24,7 @@ def main():
parser.add_argument('-t', '--tobii_ip', metavar='TOBII_IP', type=str, default=None, help='tobii glasses ip')
parser.add_argument('-c', '--camera_calibration', metavar='CAM_CALIB', type=str, default=None, help='json camera calibration filepath')
parser.add_argument('-p', '--aruco_tracker_configuration', metavar='TRACK_CONFIG', type=str, default=None, help='json aruco tracker configuration filepath')
- parser.add_argument('-md', '--marker_dictionary', metavar='MARKER_DICT', type=str, default='DICT_ARUCO_ORIGINAL', help='aruco marker dictionnary (DICT_4X4_50, DICT_4X4_100, DICT_4X4_250, DICT_4X4_1000, DICT_5X5_50, DICT_5X5_100, DICT_5X5_250, DICT_5X5_1000, DICT_6X6_50, DICT_6X6_100, DICT_6X6_250, DICT_6X6_1000, DICT_7X7_50, DICT_7X7_100, DICT_7X7_250, DICT_7X7_1000, DICT_ARUCO_ORIGINAL,DICT_APRILTAG_16h5, DICT_APRILTAG_25h9, DICT_APRILTAG_36h10, DICT_APRILTAG_36h11)')
+ parser.add_argument('-md', '--marker_dictionary', metavar='MARKER_DICT', type=ArUcoMarkersDictionary.ArUcoMarkersDictionary, default='DICT_ARUCO_ORIGINAL', help='aruco marker dictionnary (DICT_4X4_50, DICT_4X4_100, DICT_4X4_250, DICT_4X4_1000, DICT_5X5_50, DICT_5X5_100, DICT_5X5_250, DICT_5X5_1000, DICT_6X6_50, DICT_6X6_100, DICT_6X6_250, DICT_6X6_1000, DICT_7X7_50, DICT_7X7_100, DICT_7X7_250, DICT_7X7_1000, DICT_ARUCO_ORIGINAL,DICT_APRILTAG_16h5, DICT_APRILTAG_25h9, DICT_APRILTAG_36h10, DICT_APRILTAG_36h11)')
parser.add_argument('-ms', '--marker_size', metavar='MARKER_SIZE', type=float, default=6, help='aruco marker size (cm)')
parser.add_argument('-mi', '--marker_id_scene', metavar='MARKER_ID_SCENE', type=json.loads, help='{"marker": "aoi scene filepath"} dictionary')
parser.add_argument('-w', '--window', metavar='DISPLAY', type=bool, default=True, help='enable window display', action=argparse.BooleanOptionalAction)
@@ -32,9 +32,9 @@ def main():
# Manage markers id to track
if args.marker_id_scene == None:
- print(f'Track any Aruco markers from the {args.marker_dictionary} dictionary')
+ print(f'Track any Aruco markers from the {args.marker_dictionary.name} dictionary')
else:
- print(f'Track Aruco markers {list(args.marker_id_scene.keys())} from the {args.marker_dictionary} dictionary')
+ print(f'Track Aruco markers {list(args.marker_id_scene.keys())} from the {args.marker_dictionary.name} dictionary')
# Create tobii controller (with auto discovery network process if no ip argument is provided)
print("Looking for a Tobii Glasses Pro 2 device ...")
@@ -83,7 +83,7 @@ def main():
aruco_tracker.load_configuration_file(args.aruco_tracker_configuration)
- print(f'ArUcoTracker configuration for {aruco_tracker.get_markers_dictionay().get_markers_format()} markers detection:')
+ print(f'ArUcoTracker configuration for {args.marker_dictionary.name} markers detection:')
aruco_tracker.print_configuration()
# Load AOI 3D scene for each marker and create a AOI 2D scene and frame when a 'Visualisation_Plan' AOI exist
@@ -192,10 +192,10 @@ def main():
# Track markers with pose estimation and draw them
aruco_tracker.track(video_frame.matrix)
- aruco_tracker.draw(visu_frame.matrix)
+ aruco_tracker.draw_tracked_markers(visu_frame.matrix)
# When no marker is detected, no AOI scene projection can't be done
- if aruco_tracker.get_markers_number() == 0:
+ if aruco_tracker.tracked_markers_number == 0:
ts_aois_scenes[round(video_ts_ms)] = AOIFeatures.EmptyAOIScene()
@@ -205,7 +205,7 @@ def main():
aoi2D_dict = {}
# Project 3D scene on each video frame and the visualisation frame
- for (i, marker_id) in enumerate(aruco_tracker.get_markers_ids()):
+ for marker_id, marker in aruco_tracker.tracked_markers.items():
# Copy 3D scene related to detected marker
aoi3D_scene = aoi3D_scene_selector(marker_id)
@@ -214,7 +214,7 @@ def main():
continue
# Transform scene into camera referential
- aoi3D_camera = aoi3D_scene.transform(aruco_tracker.get_marker_translation(i), aruco_tracker.get_marker_rotation(i))
+ aoi3D_camera = aoi3D_scene.transform(marker.translation, marker.rotation)
# Get aoi inside vision cone field
cone_vision_height_cm = 200 # cm
@@ -227,7 +227,7 @@ def main():
# DON'T APPLY CAMERA DISTORSION : it projects points which are far from the frame into it
# This hack isn't realistic but as the gaze will mainly focus on centered AOI, where the distorsion is low, it is acceptable.
- aoi2D_video_scene = aoi3D_scene.project(aruco_tracker.get_marker_translation(i), aruco_tracker.get_marker_rotation(i), aruco_camera.get_K())
+ aoi2D_video_scene = aoi3D_scene.project(marker.translation, marker.rotation, aruco_camera.K)
# Store each 2D aoi for further scene merging
for name, aoi in aoi2D_video_scene.items():