Skip to content

Calibrate

SUMMARY

calibrate() detects the calibration target in every input image and solves for the camera's intrinsic matrix and distortion coefficients via cv::calibrateCamera.

SUPPORTED TARGETS

Works with any target, ChessboardTarget, CharucoTarget, or ArucoTarget, see All Supported Targets.

UNITS

Input images are BGR ndarrays. reprojection_error and per_view_errors are in pixels.

The Skill

python
result = calibrator.calibrate(images)
SkillReturnsDescription
calibrate(images)IntrinsicResultDetect the target in every image and run cv::calibrateCamera.

The Code

python
from telekinesis.axon import IntrinsicCalibrator, IntrinsicOptions
from telekinesis.axon.targets import CharucoTarget

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

options = IntrinsicOptions()
options.per_view_error_threshold = 0.8

calibrator = IntrinsicCalibrator(target, options)
result = calibrator.calibrate(images)

result.ok                     # bool
result.intrinsic_matrix       # (3, 3) np.ndarray
result.distortion_coefficients
result.reprojection_error
result.successful_indices
result.low_view_error_indices

IntrinsicResult

FieldTypeDescription
okboolFalse when detection or the solver failed; other fields are then only partially populated.
intrinsic_matrix(3, 3) ndarrayCamera matrix.
distortion_coefficientsndarrayDistortion coefficients.
reprojection_errorfloatMean reprojection error (px) over all successful views.
successful_indiceslist[int]Indices into the input image list with successful detections.
image_pointslist[ndarray]Detected image points per successful view.
low_view_error_indiceslist[int]Positions into successful_indices whose per-view error is below per_view_error_threshold.
per_view_errorslist[float]Per-view RMS reprojection errors from the extended solver.
std_deviations_intrinsicsndarrayStandard deviations of the intrinsics from the solver.
std_deviations_extrinsicsndarrayStandard deviations of the extrinsics from the solver.

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