diff options
Diffstat (limited to 'src/argaze/ArUcoMarkers/ArUcoCamera.py')
-rw-r--r-- | src/argaze/ArUcoMarkers/ArUcoCamera.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoCamera.py b/src/argaze/ArUcoMarkers/ArUcoCamera.py index 1371a38..f32e4b6 100644 --- a/src/argaze/ArUcoMarkers/ArUcoCamera.py +++ b/src/argaze/ArUcoMarkers/ArUcoCamera.py @@ -17,6 +17,7 @@ __copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)" __license__ = "GPLv3" from typing import Self +import logging import json import os import time @@ -132,18 +133,24 @@ class ArUcoCamera(ArFeatures.ArCamera): def watch(self, image: DataFeatures.TimestampedImage): """Detect environment aruco markers from image and project scenes into camera frame.""" + logging.debug('ArUcoCamera.watch') + # Use camera frame locker feature with self._lock: # Draw black rectangles to mask sides if self.__sides_mask > 0: + logging.debug('\t> drawing sides mask (%i px)', self.__sides_mask) + height, width, _ = image.shape cv2.rectangle(image, (0, 0), (self.__sides_mask, height), (0, 0, 0), -1) cv2.rectangle(image, (width - self.__sides_mask, 0), (width, height), (0, 0, 0), -1) # Detect aruco markers + logging.debug('\t> detect markers') + self.__aruco_detector.detect_markers(image) # Fill camera frame background with timestamped image @@ -178,11 +185,15 @@ class ArUcoCamera(ArFeatures.ArCamera): ''' # Estimate scene pose from detected scene markers + logging.debug('\t> estimate %s scene pose', scene_name) + tvec, rmat, _ = scene.estimate_pose(self.__aruco_detector.detected_markers(), timestamp=self.timestamp) # Project scene into camera frame according estimated pose for layer_name, layer_projection in scene.project(tvec, rmat, self.visual_hfov, self.visual_vfov, timestamp=self.timestamp): + logging.debug('\t> project %s scene %s layer', scene_name, layer_name) + try: # Update camera layer aoi @@ -230,7 +241,7 @@ class ArUcoCamera(ArFeatures.ArCamera): self.__aruco_detector.draw_detected_markers(image, draw_detected_markers) return image - + def image(self, **kwargs: dict) -> numpy.array: """ Get frame image. |