Python API
CamCalib is a Python library, so the CLI is one entry point rather than the only one. Every stage is importable.
Package layout
Section titled “Package layout”| Module | Contents |
|---|---|
camcalib.core | Types — Observation, CameraParams, CalibrationResult — plus config dataclasses |
camcalib.camera | One CameraModel per distortion model; projection, Jacobians, unprojection in one place |
camcalib.board | Detection — chessboard, AprilGrid, ArUco — and corner_subsample |
camcalib.io | DataLoader, streaming DetectionPipeline, data sources, detection cache, frame selector, output writers |
camcalib.calibration | Initialiser (OpenCV PnP), Optimizer (the unified factor), Pipeline, outlier_rejection, camera_projection, custom_projections |
camcalib.analysis | HTML report, plotting, Rerun 3D visualisation, motion analysis |
camcalib.recalib | apply-calib — corrected-dataset export |
camcalib.cli | Command-line interface |
Kalibr interop
Section titled “Kalibr interop”camcalib.io.kalibr is the one surface for Kalibr files:
| Function | Does |
|---|---|
read_camchain | Intrinsics + distortion across pinhole / ds / eucm / fov |
read_camchain_imucam | Also recovers each camera’s T_cam_imu and the stereo T_cn_cnm1 |
write_camchain_imucam | Exports a cam-IMU result as a round-trippable camchain-imucam |
apriltag_board.from_kalibr_yaml | Loads an AprilGrid target definition |
This is the practical path for comparing against, or migrating from, Kalibr.
Regenerating reports
Section titled “Regenerating reports”Rebuild HTML reports from saved YAML plus the detection cache, without re-running the calibration — useful when only the report template changed:
python -m camcalib.analysis.regenerate_htmlWhy the models live in one place
Section titled “Why the models live in one place”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.
Stability
Section titled “Stability”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.