aboutsummaryrefslogtreecommitdiff
path: root/src/argaze/ArFeatures.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze/ArFeatures.py')
-rw-r--r--src/argaze/ArFeatures.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 21a7d6a..a684fc6 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -39,25 +39,26 @@ class ArEnvironment():
def from_json(self, json_filepath: str) -> ArSceneType:
"""Load ArEnvironment from .json file."""
- new_name = ''
- new_working_directory = '.'
- new_aruco_detector = None
- new_scenes = {}
-
with open(json_filepath) as configuration_file:
data = json.load(configuration_file)
new_name = data.pop('name')
-
new_working_directory = os.path.dirname(json_filepath)
+ new_detector_data = data.pop('aruco_detector')
+
+ new_aruco_dictionary = ArUcoMarkersDictionary.ArUcoMarkersDictionary(new_detector_data.pop('dictionary'))
+ new_marker_size = new_detector_data.pop('marker_size')
+ new_aruco_camera = ArUcoCamera.ArUcoCamera(**new_detector_data.pop('camera'))
+ new_aruco_detecor_parameters = ArUcoDetector.DetectorParameters(**new_detector_data.pop('parameters'))
- new_aruco_detector = ArUcoDetector.ArUcoDetector(**data.pop('aruco_detector'))
+ new_aruco_detector = ArUcoDetector.ArUcoDetector(new_aruco_dictionary, new_marker_size, new_aruco_camera, new_aruco_detecor_parameters)
for scene_name, scene_data in data.items():
new_aruco_scene = None
new_aoi_scene = None
+ new_scenes = {}
# Check aruco_scene value type
aruco_scene_value = scene_data.pop('aruco_scene')
@@ -89,7 +90,7 @@ class ArEnvironment():
new_scenes[scene_name] = ArScene(self, new_aruco_scene, new_aoi_scene, **scene_data)
- return ArEnvironment(new_name, new_working_directory, new_aruco_detector, new_scenes)
+ return ArEnvironment(new_name, new_working_directory, new_aruco_detector, new_scenes)
def __str__(self) -> str:
"""String display"""