From a3d5e8c2a25d816b1c2e10e6e313f09b623af060 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Tue, 25 Apr 2023 20:05:46 +0200 Subject: Check consistency only if thre is more than one marker. --- src/argaze/utils/environment_edit.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/argaze/utils/environment_edit.py b/src/argaze/utils/environment_edit.py index 72af4c6..6b0063d 100644 --- a/src/argaze/utils/environment_edit.py +++ b/src/argaze/utils/environment_edit.py @@ -149,7 +149,9 @@ def main(): # Edit marker's color for i, m in ar_environment.aruco_detector.detected_markers.items(): - m.color = list(itertools.permutations([0, 255, 255]))[i] + color_list = list(itertools.permutations([0, 255, 255])) + + m.color = color_list[i%len(color_list)] # Draw center cv2.circle(video_frame, m.center.astype(int), 5, m.color, -1) @@ -298,18 +300,20 @@ def main(): # Estimate all marker's pose ar_environment.aruco_detector.estimate_markers_pose() - # Check markers consistency - consistent_markers, unconsistent_markers, unconsistencies = ar_scene.aruco_scene.check_markers_consistency(ar_environment.aruco_detector.detected_markers, ar_scene.angle_tolerance, ar_scene.distance_tolerance) + if len(ar_environment.aruco_detector.detected_markers) > 1: + + # Check markers consistency + consistent_markers, unconsistent_markers, unconsistencies = ar_scene.aruco_scene.check_markers_consistency(ar_environment.aruco_detector.detected_markers, ar_scene.angle_tolerance, ar_scene.distance_tolerance) - # Set unconsistent marker color to red - for i, m in ar_environment.aruco_detector.detected_markers.items(): - if i in list(unconsistent_markers.keys()): - m.color = (0, 0, 255) + # Set unconsistent marker color to red + for i, m in ar_environment.aruco_detector.detected_markers.items(): + if i in list(unconsistent_markers.keys()): + m.color = (0, 0, 255) - # Write unconsistencies - for i, (label, value) in enumerate(unconsistencies.items()): - cv2.putText(info_frame, f'Unconsistent {label}: {value:.3f}', (20, 120+ i*40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 1, cv2.LINE_AA) - + # Write unconsistencies + for i, (label, value) in enumerate(unconsistencies.items()): + cv2.putText(info_frame, f'Unconsistent {label}: {value:.3f}', (20, 120+ i*40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 1, cv2.LINE_AA) + # Single marker scene pose estimation if pose_mode == 0: -- cgit v1.1