From cbb6d0921ec527f016c8af1a990178204e1a5c53 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 14 Nov 2022 22:02:20 +0000 Subject: [PATCH] Add demo of marker detection --- examples/detect.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 examples/detect.py diff --git a/examples/detect.py b/examples/detect.py new file mode 100755 index 0000000..5b838f0 --- /dev/null +++ b/examples/detect.py @@ -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)