diff options
Diffstat (limited to 'src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py')
-rw-r--r-- | src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py b/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py index 2fd7eee..f587c59 100644 --- a/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py +++ b/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py @@ -191,6 +191,20 @@ class ArUcoMarkersGroup(DataFeatures.PipelineStepObject): "dictionary": self.__dictionary, "places": self.__places } + + @classmethod + def from_dict(cls, aruco_markers_group_data: dict, working_directory: str = None) -> ArUcoMarkersGroupType: + """Load ArUco markers group attributes from dictionary. + + Parameters: + aruco_markers_group_data: dictionary with attributes to load + working_directory: folder path where to load files when a dictionary value is a relative filepath. + """ + + new_dictionary = data.pop('dictionary') + new_places = data.pop('places') + + return ArUcoMarkersGroup(new_dictionary, new_places) @classmethod def from_obj(self, obj_filepath: str) -> ArUcoMarkersGroupType: @@ -310,22 +324,6 @@ class ArUcoMarkersGroup(DataFeatures.PipelineStepObject): return ArUcoMarkersGroup(new_dictionary, new_places) - @classmethod - def from_json(self, json_filepath: str) -> ArUcoMarkersGroupType: - """Load ArUco markers group from .json file.""" - - new_dictionary = None - new_places = {} - - with open(json_filepath) as configuration_file: - - data = json.load(configuration_file) - - new_dictionary = data.pop('dictionary') - new_places = data.pop('places') - - return ArUcoMarkersGroup(new_dictionary, new_places) - def filter_markers(self, detected_markers: dict) -> Tuple[dict, dict]: """Sort markers belonging to the group from given detected markers dict (cf ArUcoDetector.detect_markers()). |