AprilTag and ArUco generator
Real-size markers, sheets to cut and ChArUco boards for calibration, with the same dictionaries OpenCV uses. Vector output: prints sharp at any size.
At 100 mm, each cell is 12.5 mm. Reading it with margin takes about 5 pixels per cell: with a 1280 px camera and a 70° field of view, that is roughly 2 m of maximum distance.
Loading family…
To detect it
# OpenCV (Python) import cv2 dic = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_APRILTAG_36h11) detector = cv2.aruco.ArucoDetector(dic, cv2.aruco.DetectorParameters()) esquinas, ids, _ = detector.detectMarkers(gris) # pose: cv2.solvePnP con las 4 esquinas y el lado = 0.100 m # ROS 2 (apriltag_ros, tags.yaml) family: tag36h11 size: 0.100 # metros, lado del cuadro negro
How to choose, print and use a marker
A fiducial marker is a black-and-white square a camera recognizes with certainty: who it is (its ID) and where it is (its 3D position and orientation). That is why robots use them to dock at a charging station, to know where they are in a warehouse, to calibrate the camera against the arm, or to measure exactly where a part ended up. It is the cheapest way to give a robot an absolute reference: ink on paper.
Which family to use
Families differ in how many data bits they carry and how different their markers are from each other (the Hamming distance). More bits and more distance mean fewer false positives and more error correction, at the cost of smaller cells and therefore shorter reading range.
- AprilTag 36h11 is the default answer in robotics: 587 IDs, distance 11, supported by
apriltag_ros, Isaac ROS, OpenCV and almost everything else. - ArUco MIP 36h12 is its counterpart in the ArUco world; the library authors recommend it.
- ArUco 4×4 shows up in many tutorials because it reads from far away, but with only 16 bits it mistakes textures for markers. Use it only in scenes you control.
- AprilTag 16h5 and 25h9 are for long range with few IDs; 36h10 for when you need more than 587.
Two rules: do not mix families in one scene, and use the smallest dictionary that covers you (if you need 20 markers, do not enable all 1000).
What size to print
The detector needs several pixels per cell. A bench rule: about 5 pixels per cell. A marker with side mm and data bits has cells of mm (the two extra are the black border). With a camera pixels wide and horizontal field of view , the approximate maximum distance is
A 100 mm 36h11 with a 1280 px camera at 70° gives about 2.3 m. If you need it at 10 m, the marker must be over 40 cm or the camera needs more resolution or a narrower field. The generator does this math as you change the size.
The size you give the detector (size in apriltag_ros, markerLength in OpenCV) is the black square side, not the paper. Measure it with a ruler after printing: printers scale.
How to print
- Leave a white quiet zone around it (at least one cell). Without it the detector cannot find the border.
- Matte paper, stuck to something rigid and flat: glare and wrinkles break the corners, and the corners are what give you the pose.
- Print the SVG or the 300 dpi PNG at "actual size", never "fit to page". Then measure.
- For big markers, a plotter or matte vinyl; for floor tags, matte lamination.
From corners to pose
The detector returns the four corners in pixels. With the camera calibration (intrinsics and distortion) and the real size, it solves the PnP problem: which rotation and translation put a square of that size right there. Two things worth knowing from day one:
- Translation is good (millimeters at one meter); the orientation of a marker seen head-on is ambiguous, because two opposite tilts produce almost the same image. Several markers, or a large marker seen at an angle, resolve it.
- Without calibrating the camera, the pose is wrong even if the marker is detected perfectly. That is what the ChArUco board tab is for: ten photos from different angles and OpenCV returns the camera matrix.
Where it breaks
- Motion and rolling shutter: a blurred or skewed marker gives bad corners. Lower the exposure before raising the gain.
- Backlight and glare: adaptive thresholding tolerates a lot, but not a reflection on top of a cell.
- Bent tags or curved surfaces: the pose assumes a plane.
- Partial occlusion: AprilTag and ArUco cannot be read with a missing corner. If that happens often, use several markers (a bundle) and the pose of the set.