Skip to content

Python API

CamCalib is a Python library, so the CLI is one entry point rather than the only one. Every stage is importable.

ModuleContents
camcalib.coreTypes — Observation, CameraParams, CalibrationResult — plus config dataclasses
camcalib.cameraOne CameraModel per distortion model; projection, Jacobians, unprojection in one place
camcalib.boardDetection — chessboard, AprilGrid, ArUco — and corner_subsample
camcalib.ioDataLoader, streaming DetectionPipeline, data sources, detection cache, frame selector, output writers
camcalib.calibrationInitialiser (OpenCV PnP), Optimizer (the unified factor), Pipeline, outlier_rejection, camera_projection, custom_projections
camcalib.analysisHTML report, plotting, Rerun 3D visualisation, motion analysis
camcalib.recalibapply-calib — corrected-dataset export
camcalib.cliCommand-line interface

camcalib.io.kalibr is the one surface for Kalibr files:

FunctionDoes
read_camchainIntrinsics + distortion across pinhole / ds / eucm / fov
read_camchain_imucamAlso recovers each camera’s T_cam_imu and the stereo T_cn_cnm1
write_camchain_imucamExports a cam-IMU result as a round-trippable camchain-imucam
apriltag_board.from_kalibr_yamlLoads an AprilGrid target definition

This is the practical path for comparing against, or migrating from, Kalibr.

Rebuild HTML reports from saved YAML plus the detection cache, without re-running the calibration — useful when only the report template changed:

Terminal window
python -m camcalib.analysis.regenerate_html

camera/CameraModel holds each model’s projection, Jacobian, and unprojection together, and calibration/camera_projection.py is shared by the optimiser and the HTML report. That is a deliberate constraint: reported residuals are computed by the same code the solver minimised, so a report cannot disagree with the fit it describes.

There is no API-stability guarantee yet. The CLI and the config schema are the stable surface; treat direct imports as subject to change until this page is generated from the source.