Skip to content

Calibrate

SUMMARY

calibrate() solves the pose of every camera in a synchronized rig relative to a reference camera, via pairwise cv::stereoCalibrate.

SUPPORTED TARGETS

Requires a CharucoTarget, per-corner ArUco ids are needed to recover a target pose per frame. See All Supported Targets.

UNITS

Input images are BGR ndarrays. reference_T_camera_list transforms are (4, 4) SE(3) matrices with translation in meters. Reprojection errors are in pixels.

The Skill

python
result = calibrator.calibrate(
    image_lists,
    intrinsic_matrices=[],
    distortion_coefficients=[],
    output_path=None,
)
ParameterTypeDescription
image_listslist[list[ndarray]]image_lists[cam][frame]; every camera must have the same frame count.
intrinsic_matriceslist[(3, 3) ndarray]Optional per-camera K; skips the intrinsic stage when non-empty.
distortion_coefficientslist[ndarray]Optional per-camera d.
output_pathstr | PathWhen set, writes a multi_camera_calibration.json result file (directory or file path).

Each non-reference camera is paired against the reference camera; returned transforms express each camera's pose in the reference camera's frame (reference_T_camera_i). Inputs are per-camera image lists captured synchronously, frame k across all cameras must show the same target pose.

The Code

python
from telekinesis.axon import MultiCameraCalibrator
from telekinesis.axon.targets import CharucoTarget

target = CharucoTarget(squares_x=6, squares_y=9, square_length=0.012, marker_length=0.009)

calibrator = MultiCameraCalibrator(target, num_cameras=3, reference_index=1)
result = calibrator.calibrate(image_lists)  # image_lists[cam][frame]

result.ok                          # True iff every non-reference pair solved
result.reference_T_camera_list     # per-camera (4, 4) np.ndarray
result.intrinsic_matrices
result.pair_reprojection_errors

MultiCameraResult

FieldTypeDescription
okboolTrue when every non-reference pair produced a transform.
reference_indexintReference camera index.
reference_T_camera_listlist[(4, 4) ndarray]Per camera, reference_T_camera (identity at the reference index; empty for failed pairs).
intrinsic_matriceslist[(3, 3) ndarray]Per camera, camera matrix.
distortion_coefficientslist[ndarray]Per camera, distortion coefficients.
intrinsic_reprojection_errorslist[float]Per camera, intrinsic mean reprojection error (px); NaN when intrinsics were supplied externally.
pair_reprojection_errorslist[float]Per camera, stereo RMS against the reference (px); NaN at the reference index and for failed pairs.

See MultiCameraCalibrator for theory and best practices, and MultiCameraCalibrator State to read back the last result.