diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/ArFeatures.py | 25 | ||||
-rw-r--r-- | src/argaze/ArUcoMarkers/ArUcoCamera.py | 2 | ||||
-rw-r--r-- | src/argaze/utils/aruco_markers_group_export.py | 2 | ||||
-rw-r--r-- | src/argaze/utils/demo_aruco_markers_run.py | 2 |
4 files changed, 8 insertions, 23 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py index dca2e3a..599b81f 100644 --- a/src/argaze/ArFeatures.py +++ b/src/argaze/ArFeatures.py @@ -1448,9 +1448,13 @@ class ArCamera(ArFrame): yield scene_frame - def watch(self, image: numpy.array) -> Tuple[float, dict]: + def watch(self, timestamp: int|float, image: numpy.array) -> Tuple[float, dict]: """Detect AR features from image and project scenes into camera frame. + Parameters: + timestamp: image time stamp (unit does'nt matter) + image: image where to extract AR features + Returns: detection time: AR features detection time in ms. exception: dictionary with exception raised per scene. @@ -1469,25 +1473,6 @@ class ArCamera(ArFrame): watch method needs to be called first. """ - # Can't use camera frame while it is locked - wait_start = time.perf_counter() - waiting_time = 0 - - while super().locked(): - - time.sleep(1e-6) - waiting_time = (time.perf_counter() - wait_start) * 1e3 - - # TODO? return waiting time? - - # TODO? add timeout parameter? - #if waiting_time > timeout: - # return None, None - - # DEBUG - #if waiting_time > 0: - # print(f'ArCamera: waiting {waiting_time:.3f} ms before to process gaze position at {timestamp} time.') - # Project gaze position into camera frame yield self, super().look(timestamp, gaze_position) diff --git a/src/argaze/ArUcoMarkers/ArUcoCamera.py b/src/argaze/ArUcoMarkers/ArUcoCamera.py index 04226c0..1cf0896 100644 --- a/src/argaze/ArUcoMarkers/ArUcoCamera.py +++ b/src/argaze/ArUcoMarkers/ArUcoCamera.py @@ -142,7 +142,7 @@ class ArUcoCamera(ArFeatures.ArCamera): return ArUcoCamera.from_dict(aruco_camera_data, working_directory) - def watch(self, image: numpy.array) -> Tuple[float, float, dict]: + def watch(self, timestamp: int|float, image: numpy.array) -> Tuple[float, float, dict]: """Detect environment aruco markers from image and project scenes into camera frame. Returns: diff --git a/src/argaze/utils/aruco_markers_group_export.py b/src/argaze/utils/aruco_markers_group_export.py index 8740af2..92646ca 100644 --- a/src/argaze/utils/aruco_markers_group_export.py +++ b/src/argaze/utils/aruco_markers_group_export.py @@ -74,7 +74,7 @@ def main(): current_image_time = video_capture.get(cv2.CAP_PROP_POS_MSEC) # Detect markers - detection_time, projection_time, exceptions = aruco_camera.watch(video_image) + detection_time, projection_time, exceptions = aruco_camera.watch(current_image_time, video_image) # Estimate each markers pose aruco_camera.aruco_detector.estimate_markers_pose(aruco_camera.aruco_detector.detected_markers) diff --git a/src/argaze/utils/demo_aruco_markers_run.py b/src/argaze/utils/demo_aruco_markers_run.py index ce81da4..67e2845 100644 --- a/src/argaze/utils/demo_aruco_markers_run.py +++ b/src/argaze/utils/demo_aruco_markers_run.py @@ -118,7 +118,7 @@ def main(): video_chrono.restart() # Detect and project AR features - detection_time, projection_time, exceptions = aruco_camera.watch(video_image) + detection_time, projection_time, exceptions = aruco_camera.watch(capture_time, video_image) # Assess visualisation time visualisation_start = time.time() |