Change aruco dictionary

This commit is contained in:
Davide Depau 2024-08-11 20:23:47 +02:00
parent 92240741cc
commit 34fcb1fc0a
2 changed files with 10 additions and 6 deletions

View file

@ -4,14 +4,14 @@ import cv2
from cv2 import aruco
# Define the ArUco dictionary
aruco_dict = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_6X6_250)
aruco_dict = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_50)
aruco_params = cv2.aruco.DetectorParameters()
# Specify the RTSP URL
rtsp_url = sys.argv[1]
# rtsp_url = sys.argv[1]
# Capture the video stream from the RTSP URL
cap = cv2.VideoCapture(rtsp_url)
# webcam:
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
@ -32,7 +32,7 @@ while True:
frame = cv2.aruco.drawDetectedMarkers(frame, corners, ids)
# Scale frame in half
frame = cv2.resize(frame, (0, 0), fx=0.5, fy=0.5)
# frame = cv2.resize(frame, (0, 0), fx=0.5, fy=0.5)
# Display the frame
cv2.imshow("Frame", frame)
@ -44,3 +44,7 @@ while True:
# Release the capture object and close all OpenCV windows
cap.release()
cv2.destroyAllWindows()
if __name__ == '__main__':
pass

2
bot.py
View file

@ -95,7 +95,7 @@ class Bot:
# Iterate until we find all 4 aruco markers or timeout
aruco_corners = {}
annotated_image = None
aruco_dict = aruco.getPredefinedDictionary(aruco.DICT_6X6_250)
aruco_dict = aruco.getPredefinedDictionary(aruco.DICT_4X4_50)
aruco_params = aruco.DetectorParameters()
t0 = time.time()