diff options
author | Théo de la Hogue | 2023-09-05 08:49:38 +0200 |
---|---|---|
committer | Théo de la Hogue | 2023-09-05 08:49:38 +0200 |
commit | c445016b7d9f8b739ce747c34632e280f909effb (patch) | |
tree | 68493b4217d9c9277a3bae79dd2f86aa5d3dc2eb /src | |
parent | 9b9cf7ca527aa9d73386d306a1a25a315e0610d7 (diff) | |
download | argaze-c445016b7d9f8b739ce747c34632e280f909effb.zip argaze-c445016b7d9f8b739ce747c34632e280f909effb.tar.gz argaze-c445016b7d9f8b739ce747c34632e280f909effb.tar.bz2 argaze-c445016b7d9f8b739ce747c34632e280f909effb.tar.xz |
Setting default image_parameters.
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/ArUcoMarkers/ArUcoCamera.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoCamera.py b/src/argaze/ArUcoMarkers/ArUcoCamera.py index 6479896..f7fcb25 100644 --- a/src/argaze/ArUcoMarkers/ArUcoCamera.py +++ b/src/argaze/ArUcoMarkers/ArUcoCamera.py @@ -124,23 +124,24 @@ class ArUcoCamera(ArFeatures.ArCamera): # Append new scene new_scenes[aruco_scene_name] = new_aruco_scene - # Load image parameters - try: + # Set image_parameters to default if there is not + if 'image_parameters' not in aruco_camera_data.keys(): - new_image_parameters = aruco_camera_data.pop('image_parameters') + aruco_camera_data['image_parameters'] = {**ArFeatures.DEFAULT_ARFRAME_IMAGE_PARAMETERS, **DEFAULT_ARUCOCAMERA_IMAGE_PARAMETERS} + + # Set draw_layers to default if there is not + if 'draw_layers' not in aruco_camera_data['image_parameters'].keys(): - except KeyError: + aruco_camera_data['image_parameters']['draw_layers'] = {} - new_image_parameters = {**DEFAULT_ARFRAME_IMAGE_PARAMETERS, **DEFAULT_ARUCOCAMERA_IMAGE_PARAMETERS} + for layer_name, layer_data in aruco_camera_data['layers'].items(): + aruco_camera_data['image_parameters']['draw_layers'][layer_name] = ArFeatures.DEFAULT_ARLAYER_DRAW_PARAMETERS # Get values of temporary ar frame created from aruco_camera_data temp_ar_frame_values = DataStructures.as_dict(ArFeatures.ArFrame.from_dict(aruco_camera_data, working_directory)) - # Remove values from temporary ar frame scenes - temp_ar_frame_values.pop('image_parameters') - # Create new aruco camera using temporary ar frame values - return ArUcoCamera(aruco_detector=new_aruco_detector, scenes=new_scenes, image_parameters=new_image_parameters, **temp_ar_frame_values) + return ArUcoCamera(aruco_detector=new_aruco_detector, scenes=new_scenes, **temp_ar_frame_values) @classmethod def from_json(self, json_filepath: str) -> ArUcoCameraType: |