Camera Calibration Pattern Generator
Generate OpenCV-verified Checkerboards, Symmetric & Asymmetric Circles Grids, ChArUco boards, and ETH Kalibr AprilGrid targets (borderBits=2 + aprilgrid.yaml) in exact millimeter vector PDF/SVG.
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
import cv2
import numpy as np
# OpenCV expects INNER corners (squares - 1), NOT outer square counts
pattern_size = (9, 6) # (10x7 printed squares)
square_size_m = 0.024
objp = np.zeros((pattern_size[0] * pattern_size[1], 3), np.float32)
objp[:, :2] = np.mgrid[0:pattern_size[0], 0:pattern_size[1]].T.reshape(-1, 2) * square_size_m
gray = cv2.imread("captured_checkerboard.png", cv2.IMREAD_GRAYSCALE)
ok, corners = cv2.findChessboardCorners(gray, pattern_size, None)
if ok:
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
corners = cv2.cornerSubPix(gray, corners, (11, 11), (-1, -1), criteria)
print(f"Found {len(corners)} inner corners")
Checkerboard: Inner Corners vs. Printed Squares
OpenCV’s cv2.findChessboardCorners(gray, patternSize) expects the count of interior corners where four squares meet — always (squaresX - 1, squaresY - 1). A common 9×6 OpenCV checkerboard therefore prints 10 × 7 physical squares. Choosing one even and one odd square count avoids 180° rotational ambiguity in corner ordering.
Asymmetric Circles Grid Geometry Formula
Following OpenCV’s canonical CALIB_CB_ASYMMETRIC_GRID object-point specification, for row i (0..rows-1) and column j (0..cols-1) with spacing parameter s:
x(i, j) = (2 * j + (i % 2)) * s
y(i, j) = i * s
# Same-row horizontal pitch = 2 * s
# Vertical row step = s
# Nearest diagonal distance = sqrt(2) * sEntering the diagonal pitch or the horizontal pitch 2s in place of s scales your calibrated focal length and translation vectors incorrectly. Movid labels s explicitly and displays 2s and √2·s live alongside matching Python objp code.
ETHZ-ASL Kalibr AprilGrid Specification (borderBits=2 & aprilgrid.yaml)
Movid implements the exact ethz-asl/kalibr AprilGrid layout: t36h11 with 2-bit solid black borders (10×10 cells per tag), physical bottom-left ID 0 indexing (id = tagCols·row + col), and deduplicated symmetric black corner squares of side g = tagSpacing × tagSize. All exported aprilgrid.yaml dimensions use strict floating-point serialization to satisfy Kalibr’s ConfigReader.py type checks.