From 8a0210fc3b6135a91766dbf186a4e2e23f42b970 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Tue, 5 Sep 2023 12:29:39 +0200 Subject: Loading JSON file descriptor. --- src/argaze/ArUcoMarkers/ArUcoScene.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/argaze/ArUcoMarkers/ArUcoScene.py b/src/argaze/ArUcoMarkers/ArUcoScene.py index e128e0f..3bbd3f4 100644 --- a/src/argaze/ArUcoMarkers/ArUcoScene.py +++ b/src/argaze/ArUcoMarkers/ArUcoScene.py @@ -65,11 +65,21 @@ class ArUcoScene(ArFeatures.ArScene): # Check aruco_markers_group value type aruco_markers_group_value = aruco_scene_data.pop('aruco_markers_group') - # str: relative path to .obj file + # str: relative path to description file if type(aruco_markers_group_value) == str: - aruco_markers_group_value = os.path.join(working_directory, aruco_markers_group_value) - new_aruco_markers_group = ArUcoMarkersGroup.ArUcoMarkersGroup.from_obj(aruco_markers_group_value) + filepath = os.path.join(working_directory, aruco_markers_group_value) + file_format = filepath.split('.')[-1] + + # JSON file format + if file_format == 'json': + + new_aruco_markers_group = ArUcoMarkersGroup.ArUcoMarkersGroup.from_json(filepath) + + # OBJ file format + elif file_format == 'obj': + + new_aruco_markers_group = ArUcoMarkersGroup.ArUcoMarkersGroup.from_obj(filepath) # dict: else: -- cgit v1.1