draw detectedMarkers

This commit is contained in:
2025-11-24 21:53:21 +01:00
parent 92f55249b9
commit 4431f3a574
3 changed files with 12 additions and 3 deletions
+5 -1
View File
@@ -31,7 +31,7 @@ def main():
# load the ArUCo dictionary, grab the ArUCo parameters, and detect
# the markers
print("[INFO] detecting '{}' tags...".format(args["type"]))
detector, board = factory(ARUCO_DICT[args["type"]], (6,7))
detector, board = factory(ARUCO_DICT[args["type"]], (3,3))
# load the input image from disk and resize it
print("[INFO] start processing...")
@@ -61,9 +61,13 @@ def process(detector: cv.aruco.CharucoDetector, board, img, mtx, dist): # Load p
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
charuco_corners, charuco_ids, marker_corners, marker_ids = detector.detectBoard(gray)
if charuco_corners is not None:
# Draw a square around the markers
cv.aruco.drawDetectedCornersCharuco(img, charuco_corners, charuco_ids)
# Draw a square around the markers
cv.aruco.drawDetectedMarkers(img, marker_corners)
if len(charuco_ids) > 5:
obj_points, img_points = board.matchImagePoints(charuco_corners, charuco_ids)
pose, rvec, tvec = cv.solvePnP(obj_points, img_points, mtx, dist, None, None)