aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2023-07-05 08:43:07 +0200
committerThéo de la Hogue2023-07-05 08:43:07 +0200
commit9e0c55061137e5be053bb837449c8eb413086428 (patch)
treeba0415eff134622a5325e5d0ce0fa608cc0fe1f8
parent2926bf603ba11a74eb2c02a17b3d3298b073125c (diff)
downloadargaze-9e0c55061137e5be053bb837449c8eb413086428.zip
argaze-9e0c55061137e5be053bb837449c8eb413086428.tar.gz
argaze-9e0c55061137e5be053bb837449c8eb413086428.tar.bz2
argaze-9e0c55061137e5be053bb837449c8eb413086428.tar.xz
Removing useless test. Using condition instead of try except strucutre. Reporting detection time.
-rw-r--r--src/argaze/ArFeatures.py27
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: