aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/user_guide/aruco_markers_pipeline/advanced_topics/scripting.md8
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoCamera.py12
2 files changed, 16 insertions, 4 deletions
diff --git a/docs/user_guide/aruco_markers_pipeline/advanced_topics/scripting.md b/docs/user_guide/aruco_markers_pipeline/advanced_topics/scripting.md
index 529bff8..892d6dd 100644
--- a/docs/user_guide/aruco_markers_pipeline/advanced_topics/scripting.md
+++ b/docs/user_guide/aruco_markers_pipeline/advanced_topics/scripting.md
@@ -79,9 +79,9 @@ for name, aruco_scene in aruco_camera.scenes.items():
...:
# Watch image with ArUco camera
- detection_time, exception = aruco_camera.watch(image)
+ detection_time, projection_time, exception = aruco_camera.watch(image)
- # Do something with pipeline detection time
+ # Do something with pipeline times
...
# Do something with pipeline exception
@@ -95,6 +95,10 @@ Let's understand the meaning of each returned data.
ArUco marker detection time in ms.
+### *projection_time*
+
+Scenes projection time in ms.
+
### *exception*
A [python Exception](https://docs.python.org/3/tutorial/errors.html#exceptions) object raised during pipeline execution.
diff --git a/src/argaze/ArUcoMarkers/ArUcoCamera.py b/src/argaze/ArUcoMarkers/ArUcoCamera.py
index 4f00a3a..33f5b37 100644
--- a/src/argaze/ArUcoMarkers/ArUcoCamera.py
+++ b/src/argaze/ArUcoMarkers/ArUcoCamera.py
@@ -11,6 +11,7 @@ from typing import TypeVar, Tuple
from dataclasses import dataclass, field
import json
import os
+import time
from argaze import ArFeatures, DataStructures
from argaze.ArUcoMarkers import ArUcoMarkersDictionary, ArUcoDetector, ArUcoOpticCalibrator, ArUcoScene
@@ -146,6 +147,7 @@ class ArUcoCamera(ArFeatures.ArCamera):
Returns:
detection time: aruco marker detection time in ms.
+ projection time: scenes projection time in ms.
exception: dictionary with exception raised per scene.
"""
@@ -155,6 +157,9 @@ class ArUcoCamera(ArFeatures.ArCamera):
# Lock camera frame exploitation
self._frame_lock.acquire()
+ # Store projection execution start date
+ projection_start = time.perf_counter()
+
# Fill camera frame background with image
self.background = image
@@ -206,11 +211,14 @@ class ArUcoCamera(ArFeatures.ArCamera):
exceptions[scene_name] = e
+ # Assess projection time in ms
+ projection_time = (time.perf_counter() - projection_start) * 1e3
+
# Unlock camera frame exploitation
self._frame_lock.release()
- # Return dection time and exceptions
- return detection_time, exceptions
+ # Return detection time, projection time and exceptions
+ return detection_time, projection_time, exceptions
def __image(self, draw_detected_markers: dict = None, draw_scenes: dict = None, draw_optic_parameters_grid: dict = None, **kwargs: dict) -> numpy.array:
"""Get frame image with ArUco detection visualisation.