2022-11-14 22:02:20 +00:00
|
|
|
import cv2
|
|
|
|
import cv2.aruco as aruco
|
|
|
|
|
|
|
|
aruco_dict = aruco.Dictionary_get(aruco.DICT_APRILTAG_36H11)
|
|
|
|
parameters = aruco.DetectorParameters_create()
|
|
|
|
|
2022-11-15 19:19:57 +00:00
|
|
|
cap = cv2.VideoCapture(0)
|
2022-11-14 22:02:20 +00:00
|
|
|
|
|
|
|
while True:
|
|
|
|
_, frame = cap.read()
|
|
|
|
corners, ids, rejects = aruco.detectMarkers(frame, aruco_dict, parameters=parameters)
|
|
|
|
aruco.drawDetectedMarkers(frame, corners, ids)
|
|
|
|
aruco.drawDetectedMarkers(frame, rejects, borderColor=(0, 0, 255))
|
|
|
|
|
|
|
|
cv2.imshow('preview', frame)
|
|
|
|
cv2.waitKey(1)
|