From 3285e91ae2b1a6d74f7f34f329ec2b573bba899a Mon Sep 17 00:00:00 2001 From: Ackimixs_ Date: Thu, 14 Dec 2023 19:22:59 +0100 Subject: [PATCH] update les distance --- get_the_focal.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/get_the_focal.py b/get_the_focal.py index 098c738..5ebfcf3 100644 --- a/get_the_focal.py +++ b/get_the_focal.py @@ -3,10 +3,10 @@ import cv2.aruco as aruco import numpy as np # Actual width of the Aruco tag in some unit (like centimeters) -W = 1.8 +W = 20 # Actual distance from the camera to the object in the same unit as W -D = 15.0 +D = 150 # Charger une image depuis la caméra (0 pour la caméra par défaut, généralement la webcam) cap = cv.VideoCapture(0) @@ -43,7 +43,10 @@ while True: # Loop over the detected ArUCo corners for (markerCorners, markerID) in zip(corners, ids): # Extract the marker corners - corners = markerCorners.reshape((4, 2)) + try: + corners = markerCorners.reshape((4, 2)) + except: + continue (topLeft, topRight, bottomRight, bottomLeft) = corners # Convert each of the (x, y)-coordinate pairs to integers