aboutsummaryrefslogtreecommitdiff
path: root/src/argaze/ArUcoMarkers/ArUcoScene.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze/ArUcoMarkers/ArUcoScene.py')
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoScene.py56
1 files changed, 1 insertions, 55 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoScene.py b/src/argaze/ArUcoMarkers/ArUcoScene.py
index 5000833..999fd6f 100644
--- a/src/argaze/ArUcoMarkers/ArUcoScene.py
+++ b/src/argaze/ArUcoMarkers/ArUcoScene.py
@@ -16,7 +16,6 @@ __credits__ = []
__copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)"
__license__ = "GPLv3"
-from typing import TypeVar, Tuple
import json
import os
@@ -27,9 +26,6 @@ from argaze.AreaOfInterest import AOI2DScene
import cv2
import numpy
-ArUcoSceneType = TypeVar('ArUcoScene', bound="ArUcoScene")
-# Type definition for type annotation convenience
-
class ArUcoScene(ArFeatures.ArScene):
"""
Define an ArScene based on an ArUcoMarkersGroup description.
@@ -82,58 +78,8 @@ class ArUcoScene(ArFeatures.ArScene):
self.__aruco_markers_group.parent = self
- @classmethod
- def from_dict(cls, aruco_scene_data: dict, working_directory: str = None) -> ArUcoSceneType:
- """
- Load ArUcoScene from dictionary.
-
- Parameters:
- aruco_scene_data: dictionary
- working_directory: folder path where to load files when a dictionary value is a relative filepath.
- """
-
- # Load aruco markers group
- try:
-
- # Check aruco_markers_group value type
- aruco_markers_group_value = aruco_scene_data.pop('aruco_markers_group')
-
- # str: relative path to description file
- if type(aruco_markers_group_value) == str:
-
- 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:
-
- new_aruco_markers_group = ArUcoMarkersGroup.ArUcoMarkersGroup(**aruco_markers_group_value)
-
- except KeyError:
-
- new_aruco_markers_group = None
-
- # Load temporary scene from aruco_scene_data then export it as dict
- temp_scene_data = ArFeatures.ArScene.from_dict(aruco_scene_data, working_directory).as_dict()
-
- # Create new aruco scene using temporary ar scene values
- return ArUcoScene( \
- aruco_markers_group = new_aruco_markers_group, \
- **temp_scene_data \
- )
-
@DataFeatures.PipelineStepMethod
- def estimate_pose(self, detected_markers: dict) -> Tuple[numpy.array, numpy.array, dict]:
+ def estimate_pose(self, detected_markers: dict) -> tuple[numpy.array, numpy.array, dict]:
"""Estimate scene pose from detected ArUco markers.
Parameters: