diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/ArFeatures.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py index ceca69f..a4601bb 100644 --- a/src/argaze/ArFeatures.py +++ b/src/argaze/ArFeatures.py @@ -349,22 +349,25 @@ class ArEnvironment(): yield scene_name, frame_name, frame - def detect_and_project(self, image: numpy.array) -> dict: - """Detect environment aruco markers from image and project scenes into camera frame.""" + def detect_and_project(self, image: numpy.array) -> int: + """Detect environment aruco markers from image and project scenes into camera frame. + + Returns: + - time: marker detection time in ms + """ # Detect aruco markers - self.aruco_detector.detect_markers(image) - + detection_time = self.aruco_detector.detect_markers(image) + # Project each aoi 3d scene into camera frame for scene_name, scene in self.scenes.items(): - # Project scene - try: + if scene.aruco_aoi: - # Try to build AOI scene from detected ArUco marker corners + # Build AOI scene directly from detected ArUco marker corners scene.build_aruco_aoi_scene(self.aruco_detector.detected_markers) - except SceneProjectionFailed: + else: # Estimate scene markers poses self.aruco_detector.estimate_markers_pose(scene.aruco_scene.identifiers) @@ -378,6 +381,8 @@ class ArEnvironment(): # Project scene into camera frame according estimated pose scene.project(tvec, rmat) + return detection_time + def look(self, timestamp: int|float, gaze_position: GazeFeatures.GazePosition): """Project timestamped gaze position into each scene.""" @@ -839,10 +844,8 @@ class ArScene(): built AOI 2D scene """ - # Check aruco aoi is defined - if len(self.aruco_aoi) == 0: - - raise SceneProjectionFailed('No aruco aoi is defined') + # ArUco aoi must be defined + assert(self.aruco_aoi) # AOI projection fails when no marker is detected if len(detected_markers) == 0: |