diff options
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: |