mirror of
https://github.com/modelec/detection_pot.git
synced 2026-03-18 21:40:33 +01:00
update les distance
This commit is contained in:
@@ -3,10 +3,10 @@ import cv2.aruco as aruco
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
# Actual width of the Aruco tag in some unit (like centimeters)
|
# 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
|
# 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)
|
# Charger une image depuis la caméra (0 pour la caméra par défaut, généralement la webcam)
|
||||||
cap = cv.VideoCapture(0)
|
cap = cv.VideoCapture(0)
|
||||||
@@ -43,7 +43,10 @@ while True:
|
|||||||
# Loop over the detected ArUCo corners
|
# Loop over the detected ArUCo corners
|
||||||
for (markerCorners, markerID) in zip(corners, ids):
|
for (markerCorners, markerID) in zip(corners, ids):
|
||||||
# Extract the marker corners
|
# Extract the marker corners
|
||||||
corners = markerCorners.reshape((4, 2))
|
try:
|
||||||
|
corners = markerCorners.reshape((4, 2))
|
||||||
|
except:
|
||||||
|
continue
|
||||||
(topLeft, topRight, bottomRight, bottomLeft) = corners
|
(topLeft, topRight, bottomRight, bottomLeft) = corners
|
||||||
|
|
||||||
# Convert each of the (x, y)-coordinate pairs to integers
|
# Convert each of the (x, y)-coordinate pairs to integers
|
||||||
|
|||||||
Reference in New Issue
Block a user