diff options
Diffstat (limited to 'src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py')
-rw-r--r-- | src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py b/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py index 49bc7df..c57497d 100644 --- a/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py +++ b/src/argaze/ArUcoMarkers/ArUcoMarkersGroup.py @@ -79,33 +79,52 @@ class Place(): corners: numpy.array marker: dict -@dataclass class ArUcoMarkersGroup(DataFeatures.PipelineStepObject): """ Handle group of ArUco markers as one unique spatial entity and estimate its pose. """ - def __init__(self, dictionary: ArUcoMarkersDictionary.ArUcoMarkersDictionary = None, places: dict = None, **kwargs): - """Initialize ArUcoMarkersGroup + @DataFeatures.PipelineStepInit + def __init__(self, **kwargs): + """Initialize ArUcoMarkersGroup""" - Parameters: - dictionary: expected dictionary of all markers in the group. - places: expected markers place. - """ + # DEBUG + print('ArUcoMarkersGroup.__init__', kwargs.keys()) # Init parent classes - DataFeatures.PipelineStepObject.__init__(self, **kwargs) + super().__init__() # Init private attributes - self.__dictionary = dictionary - self.__places = places + self.__dictionary = None + self.__places = {} self.__translation = numpy.zeros(3) self.__rotation = numpy.zeros(3) + @property + def dictionary(self) -> ArUcoMarkersDictionary.ArUcoMarkersDictionary: + """Expected dictionary of all markers in the group.""" + return self.__dictionary + + @dictionary.setter + def dictionary(self, dictionary: ArUcoMarkersDictionary.ArUcoMarkersDictionary): + + self.__dictionary = dictionary + + @property + def places(self) -> dict: + """Expected markers place.""" + return self.__places + + @places.setter + def places(self, places: dict): + + # DEBUG + print('ArUcoMarkersGroup.places.setter', places) + # Normalize places data new_places = {} - for identifier, data in self.__places.items(): + for identifier, data in places.items(): # Convert string identifier to int value if type(identifier) == str: @@ -157,15 +176,8 @@ class ArUcoMarkersGroup(DataFeatures.PipelineStepObject): self.__places = new_places - @property - def dictionary(self) -> ArUcoMarkersDictionary.ArUcoMarkersDictionary: - """Get ArUco marker group ArUco dictionary.""" - return self.__dictionary - - @property - def places(self) -> dict: - """Get ArUco marker group places dictionary.""" - return self.__places + # DEBUG + print('ArUcoMarkersGroup.places.setter *********************') @property def identifiers(self) -> list: @@ -202,20 +214,6 @@ class ArUcoMarkersGroup(DataFeatures.PipelineStepObject): } @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 = aruco_markers_group_data.pop('dictionary') - new_places = aruco_markers_group_data.pop('places') - - return ArUcoMarkersGroup(new_dictionary, new_places) - - @classmethod def from_obj(self, obj_filepath: str) -> ArUcoMarkersGroupType: """Load ArUco markers group from .obj file. |