aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2023-04-25 20:05:46 +0200
committerThéo de la Hogue2023-04-25 20:05:46 +0200
commita3d5e8c2a25d816b1c2e10e6e313f09b623af060 (patch)
tree692f31a0cd5abd98a3037a70e3a9bf001e623f16
parent313b4c3a0ab4fc6023237c3f8f8989fcacb4b4cc (diff)
downloadargaze-a3d5e8c2a25d816b1c2e10e6e313f09b623af060.zip
argaze-a3d5e8c2a25d816b1c2e10e6e313f09b623af060.tar.gz
argaze-a3d5e8c2a25d816b1c2e10e6e313f09b623af060.tar.bz2
argaze-a3d5e8c2a25d816b1c2e10e6e313f09b623af060.tar.xz
Check consistency only if thre is more than one marker.
-rw-r--r--src/argaze/utils/environment_edit.py26
1 files 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: