Add demo of marker detection
This commit is contained in:
parent
44be5ab82a
commit
cbb6d0921e
1 changed files with 16 additions and 0 deletions
16
examples/detect.py
Executable file
16
examples/detect.py
Executable file
|
@ -0,0 +1,16 @@
|
|||
import cv2
|
||||
import cv2.aruco as aruco
|
||||
|
||||
aruco_dict = aruco.Dictionary_get(aruco.DICT_APRILTAG_36H11)
|
||||
parameters = aruco.DetectorParameters_create()
|
||||
|
||||
cap = cv2.VideoCapture(2)
|
||||
|
||||
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)
|
Loading…
Reference in a new issue