From 4e06b458990ea4c4b3de7afe4b1fe343f1a8f214 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Mon, 29 Jan 2024 10:27:26 +0100 Subject: Using cls word instead of self word. Fixing demo. --- src/argaze/ArFeatures.py | 11 ++++------- src/argaze/ArUcoMarkers/ArUcoCamera.py | 2 +- src/argaze/ArUcoMarkers/ArUcoDetector.py | 2 +- src/argaze/ArUcoMarkers/ArUcoScene.py | 2 +- src/argaze/AreaOfInterest/AOIFeatures.py | 4 ++-- src/argaze/DataFeatures.py | 2 +- src/argaze/GazeFeatures.py | 2 +- src/argaze/utils/demo_aruco_markers_run.py | 2 +- 8 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py index ed3eb9b..0333565 100644 --- a/src/argaze/ArFeatures.py +++ b/src/argaze/ArFeatures.py @@ -229,7 +229,7 @@ class ArLayer(DataFeatures.SharedObject, DataFeatures.PipelineStepObject): } @classmethod - def from_dict(self, layer_data: dict, working_directory: str = None) -> ArLayerType: + def from_dict(cls, layer_data: dict, working_directory: str = None) -> ArLayerType: """Load ArLayer attributes from dictionary. Parameters: @@ -680,7 +680,7 @@ class ArFrame(DataFeatures.SharedObject, DataFeatures.PipelineStepObject): return d @classmethod - def from_dict(self, frame_data: dict, working_directory: str = None) -> ArFrameType: + def from_dict(cls, frame_data: dict, working_directory: str = None) -> ArFrameType: """Load ArFrame attributes from dictionary. Parameters: @@ -1154,7 +1154,7 @@ class ArScene(DataFeatures.PipelineStepObject): } @classmethod - def from_dict(self, scene_data: dict, working_directory: str = None) -> ArSceneType: + def from_dict(cls, scene_data: dict, working_directory: str = None) -> ArSceneType: """ Load ArScene attributes from dictionary. @@ -1162,9 +1162,6 @@ class ArScene(DataFeatures.PipelineStepObject): scene_data: dictionary working_directory: folder path where to load files when a dictionary value is a relative filepath. """ - - # DEBUG - print('ArScene.from_dict self:', self) # Load layers new_layers = {} @@ -1478,7 +1475,7 @@ class ArCamera(ArFrame): with self._lock: # Project gaze position into each scene frames if possible - for scene_frame in self.scene_frames: + for scene_frame in self.scene_frames(): # Is there an AOI inside camera frame layers projection which its name equals to a scene frame name? for camera_layer_name, camera_layer in self.layers.items(): diff --git a/src/argaze/ArUcoMarkers/ArUcoCamera.py b/src/argaze/ArUcoMarkers/ArUcoCamera.py index adaab94..e4a9eeb 100644 --- a/src/argaze/ArUcoMarkers/ArUcoCamera.py +++ b/src/argaze/ArUcoMarkers/ArUcoCamera.py @@ -76,7 +76,7 @@ class ArUcoCamera(ArFeatures.ArCamera): return self.__aruco_detector @classmethod - def from_dict(self, aruco_camera_data: dict, working_directory: str = None) -> ArUcoCameraType: + def from_dict(cls, aruco_camera_data: dict, working_directory: str = None) -> ArUcoCameraType: """ Load ArUcoCamera from dictionary. diff --git a/src/argaze/ArUcoMarkers/ArUcoDetector.py b/src/argaze/ArUcoMarkers/ArUcoDetector.py index 0dd07c8..d326aaa 100644 --- a/src/argaze/ArUcoMarkers/ArUcoDetector.py +++ b/src/argaze/ArUcoMarkers/ArUcoDetector.py @@ -203,7 +203,7 @@ class ArUcoDetector(DataFeatures.PipelineStepObject): self.__parameters = value @classmethod - def from_dict(self, aruco_detector_data: dict, working_directory: str = None) -> ArUcoDetectorType: + def from_dict(cls, aruco_detector_data: dict, working_directory: str = None) -> ArUcoDetectorType: """Load ArUcoDetector attributes from dictionary. Parameters: diff --git a/src/argaze/ArUcoMarkers/ArUcoScene.py b/src/argaze/ArUcoMarkers/ArUcoScene.py index b8817b3..f1bdf5e 100644 --- a/src/argaze/ArUcoMarkers/ArUcoScene.py +++ b/src/argaze/ArUcoMarkers/ArUcoScene.py @@ -45,7 +45,7 @@ class ArUcoScene(ArFeatures.ArScene): return self.__aruco_markers_group @classmethod - def from_dict(self, aruco_scene_data: dict, working_directory: str = None) -> ArUcoSceneType: + def from_dict(cls, aruco_scene_data: dict, working_directory: str = None) -> ArUcoSceneType: """ Load ArUcoScene from dictionary. diff --git a/src/argaze/AreaOfInterest/AOIFeatures.py b/src/argaze/AreaOfInterest/AOIFeatures.py index d97cda6..6149da4 100644 --- a/src/argaze/AreaOfInterest/AOIFeatures.py +++ b/src/argaze/AreaOfInterest/AOIFeatures.py @@ -44,7 +44,7 @@ class AreaOfInterest(numpy.ndarray): return repr(self.tolist()) @classmethod - def from_dict(self, aoi_data: dict, working_directory: str = None) -> AreaOfInterestType: + def from_dict(cls, aoi_data: dict, working_directory: str = None) -> AreaOfInterestType: """Load attributes from dictionary. Parameters: @@ -289,7 +289,7 @@ class AOIScene(): self[name] = AreaOfInterest(area) @classmethod - def from_dict(self, aoi_scene_data: dict, working_directory: str = None) -> AOISceneType: + def from_dict(cls, aoi_scene_data: dict, working_directory: str = None) -> AOISceneType: """Load attributes from dictionary. Parameters: diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py index 3dcc7e4..e36b52f 100644 --- a/src/argaze/DataFeatures.py +++ b/src/argaze/DataFeatures.py @@ -448,7 +448,7 @@ class PipelineStepObject(): } @classmethod - def from_dict(self, object_data: dict, working_directory: str = None) -> object: + def from_dict(cls, object_data: dict, working_directory: str = None) -> object: """Load PipelineStepObject attributes from dictionary. Returns: diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py index 815a496..7254205 100644 --- a/src/argaze/GazeFeatures.py +++ b/src/argaze/GazeFeatures.py @@ -217,7 +217,7 @@ class GazePositionCalibrator(): """Abstract class to define what should provide a gaze position calibrator algorithm.""" @classmethod - def from_dict(self, calibrator_data: dict) -> GazePositionCalibratorType: + def from_dict(cls, calibrator_data: dict) -> GazePositionCalibratorType: """Load gaze position calibrator from dictionary. Parameters: diff --git a/src/argaze/utils/demo_aruco_markers_run.py b/src/argaze/utils/demo_aruco_markers_run.py index 1de2b98..3ad8cca 100644 --- a/src/argaze/utils/demo_aruco_markers_run.py +++ b/src/argaze/utils/demo_aruco_markers_run.py @@ -159,7 +159,7 @@ def main(): cv2.imshow(aruco_camera.name, aruco_camera_image) # Draw and display each scene frames - for scene_frame in aruco_camera.scene_frames: + for scene_frame in aruco_camera.scene_frames(): # Display scene frame cv2.imshow(f'{scene_frame.parent.name}:{scene_frame.name}', scene_frame.image()) -- cgit v1.1