Use cv.putext for status

This commit is contained in:
2025-11-30 22:20:15 +01:00
parent 50bec56ea7
commit 0d9aa84df8
+4 -2
View File
@@ -137,13 +137,15 @@ class Detector(abc.ABC):
for det in self.detector:
det.calibration_clear()
y_pos = 30
for det in self.detector:
success, r_vec, t_vec = det.process(img)
if success:
r_vec_obj, _ = to_board_pose_euler(r_vec, t_vec)
rot = [round(180.0 / math.pi * v, 1) for v in r_vec_obj]
print("\r ", end='')
print(f"\r{det}: Tilt: {rot[0]:.1f}, Roll: {rot[1]:.1f}, Azimuth: {rot[2]:.1f}", end='')
cv.putText(img, f"{det}: Tilt: {rot[0]:.1f}, Roll: {rot[1]:.1f}, Azimuth: {rot[2]:.1f}",
(30, y_pos), cv.FONT_HERSHEY_SIMPLEX, 0.75, (0, 255, 0), 2)
y_pos += 30
img_scaled = cv.resize(img, dsize=None, fx=0.5, fy=0.5)
cv.imshow('img', img_scaled)