diff options
author | Théo de la Hogue | 2024-05-28 17:31:04 +0200 |
---|---|---|
committer | Théo de la Hogue | 2024-05-28 17:31:04 +0200 |
commit | 15cacb17bd0ce27e5e8c90b8f29fd2affe301d8d (patch) | |
tree | 16e40bcb7399972795863cd54522a04a8b29c1e4 | |
parent | f4a78005a3fe7e8b0019ad16dd83c76992933f87 (diff) | |
download | argaze-15cacb17bd0ce27e5e8c90b8f29fd2affe301d8d.zip argaze-15cacb17bd0ce27e5e8c90b8f29fd2affe301d8d.tar.gz argaze-15cacb17bd0ce27e5e8c90b8f29fd2affe301d8d.tar.bz2 argaze-15cacb17bd0ce27e5e8c90b8f29fd2affe301d8d.tar.xz |
Clearing frame background. Calling map method inside its own try block.
-rw-r--r-- | src/argaze/ArFeatures.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py index 79af23c..ba602de 100644 --- a/src/argaze/ArFeatures.py +++ b/src/argaze/ArFeatures.py @@ -1435,6 +1435,9 @@ class ArCamera(ArFrame): # Project camera frame background into each scene frame if possible for frame in self.scene_frames(): + # Clear frame background + frame.background = DataFeatures.TimestampedImage(numpy.full((frame.size[1], frame.size[0], 3), 0).astype(numpy.uint8), timestamp=self.background.timestamp) + # 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(): @@ -1448,14 +1451,13 @@ class ArCamera(ArFrame): mapping = cv2.getPerspectiveTransform(aoi_2d.astype(numpy.float32), destination) frame.background = DataFeatures.TimestampedImage(cv2.warpPerspective(self.background, mapping, (width, height)), timestamp=self.background.timestamp) - # Notify frame 'on_map' signal observers - frame.send_signal('map', timestamp=self.background.timestamp) - # Ignore missing frame projection except KeyError: pass + # Notify frame's 'on_map' signal observers + frame.send_signal('map', timestamp=self.background.timestamp) # Define default ArContext image parameters DEFAULT_ARCONTEXT_IMAGE_PARAMETERS = { @@ -1616,7 +1618,20 @@ class ArContext(DataFeatures.PipelineStepObject): self.__pipeline.watch(DataFeatures.TimestampedImage(image, timestamp=timestamp)) - # TODO: make this step optional + + self.__pipeline.map(timestamp=timestamp) + + except DataFeatures.TimestampedException as e: + + logging.warning('%s._process_camera_image: %s', DataFeatures.get_class_path(self), e) + + self.__exceptions.append(e) + + # TODO: make map step optional + try: + + logging.debug('\t> map image (%i x %i)', width, height) + self.__pipeline.map(timestamp=timestamp) except DataFeatures.TimestampedException as e: |