ArUco & ChArUco Generator
Generate OpenCV-verified single markers, multi-page batch sheets, GridBoards, and ChArUco calibration boards with merged vector black paths, dual-axis verification rulers, and runnable Python snippets.
Export files encode target physical dimensions (1 mm = 72/25.4 pt). Always print PDF at 100% / Actual Size (disable Fit to Page) and measure both X and Y check rulers with a physical caliper or ruler before calibration.
# Verified with OpenCV 4.13.0 (Python, OpenCV >= 4.7 modern ArUco API)
import cv2
dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_6X6_250)
detector_params = cv2.aruco.DetectorParameters()
detector_params.markerBorderBits = 1
detector = cv2.aruco.ArucoDetector(dictionary, detector_params)
# Physical marker side length (including 1-cell black border): 0.1000 m
marker_length_m = 0.1
image = cv2.imread("captured_frame.png")
corners, ids, rejected = detector.detectMarkers(image)
if ids is not None:
print("Detected IDs:", ids.flatten().tolist())
ChArUco legacyPattern Parity Rules (OpenCV <4.6 vs >=4.6)
OpenCV 4.6 changed how ChArUco boards assign the top-left square when the vertical square count (squaresY) is even, and OpenCV 4.7+ added board.setLegacyPattern(True) to restore backward compatibility. Mixing boards across modes causes incorrect corner indices or failed detection.
| Condition (squaresY = square rows) | Default (legacyPattern = False, OpenCV >=4.6) | Legacy (legacyPattern = True, OpenCV <4.6) |
|---|---|---|
| squaresY is even | Top-left cell (0, 0) is a black chessboard square; marker ID 0 starts at (1, 0). | Top-left cell (0, 0) is a white square with ArUco marker ID 0. |
| squaresY is odd | Top-left cell (0, 0) is black; marker ID 0 starts at (1, 0). | Identical layout to modern default (top-left is black). |
borderBits vs. External White Quiet Zone
In OpenCV ArUco, borderBits sets the thickness of the internal black border measured in payload cells (default 1). Changing borderBits requires matching DetectorParameters.markerBorderBits in your detector. The external quiet zone is the clean white contrast border surrounding the outside of the black marker; keep crop marks, captions, and rulers outside it.
Why Smaller Dictionaries Reduce False Positives
Although DICT_4X4_50, 100, and 250 share the same ID patterns as prefixes of DICT_4X4_1000, smaller dictionaries maintain larger minimum inter-marker Hamming distance and higher default maxCorrectionBits. Always pick the smallest dictionary that covers your required ID count.