s6.utils.calibration¶

Calibration utilities: ChArUco board construction and helpers.

This module centralizes calibration constants and helpers used by simulation and calibration CLIs. It provides:

  • Board constants (dictionary, grid size, physical dimensions)

  • create_board() that returns a rendered board image and the board object

  • to_gray(img) to normalize images to grayscale

  • calibrate_camera(…) that runs cv2.calibrateCamera over ChArUco 2D–3D correspondences (built from detections and the known board geometry)

s6.utils.calibration.create_board() tuple[ndarray, cv2.aruco_CharucoBoard]

Create a ChArUco board and render a PNG-like image as a NumPy array.

Returns:

image is a uint8 grayscale image containing the printed board. board is the OpenCV ChArUcoBoard object for detection/calibration.

Return type:

(image, board)

s6.utils.calibration.to_gray(img: ndarray) ndarray
s6.utils.calibration.calibrate_camera(charuco_corners: List[ndarray], charuco_ids: List[ndarray], board: cv2.aruco_CharucoBoard, image_size: Tuple[int, int]) Dict

Calibrate intrinsics using cv2.calibrateCamera with ChArUco detections.

Converts each frame’s detected ChArUco corners into corresponding 3D-2D correspondences using the board geometry, then runs cv2.calibrateCamera.