Camera calibration tool for USB cameras and video files
Project description
calicam
Camera calibration tool for USB cameras.
Features
- Live streaming from any USB/built-in camera (by index) or pre-recorded video file
- Auto-capture mode (default) — frames are accepted automatically when the board is detected and the camera has moved enough relative to the previous capture
- Running reprojection error — updates after every new frame so you can watch it stabilise in real time
- Dear PyGui GUI — GPU-accelerated, zero-dependency desktop UI
- YAML output matching OpenCV's
cv::FileStorageformat (compatible with Bonsai, FreeMoCap, etc.) - JSON output for everything else
- CLI helpers:
convert,inspect
Installation
uv tool install calicam
Requires Python 3.10+.
Quick start
calicam gui
# Convert between formats
calicam convert calibration.yaml # -> calibration.json
calicam convert calibration.json -o cam0.yaml
# Print a summary
calicam inspect calibration.yaml
GUI overview
| Panel | Description |
|---|---|
| Camera feed | Live frame with detected corners drawn |
| Source | Camera index or video file path; Start/Stop |
| Board | Inner corner grid size and square size |
| Capture | Auto/manual mode, frame counter, Reset |
| Reprojection Error | Current RMS (px) + live plot over captured frames |
| Calibrate & Save | Calibrate once target frame count reached; save YAML / JSON |
Reprojection error colour coding: green < 0.5 px · yellow 0.5–1.0 px · red > 1.0 px
YAML format
%YAML:1.0
image_width: 640
image_height: 480
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 1.08e+03, 0., 1.93e+02, 0., 1.13e+03, 2.53e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -1.25, -4.12, -0.005, 0.163, 18.98 ]
reprojection_error: 8.39e-01
Python API
from calicam import Calibrator, CameraSource, save_yaml, load_yaml
# Headless calibration from a video file
with CameraSource("/path/to/video.mp4") as cam:
calibrator = Calibrator(board_cols=9, board_rows=6, square_size_mm=25.0)
for frame in cam.frames():
found, corners, _ = calibrator.detect(frame)
if found and calibrator.should_auto_capture(corners):
error = calibrator.add_frame(corners, (cam.width, cam.height))
if error is not None:
print(f" frames={calibrator.n_frames} RMS={error:.4f}")
if calibrator.n_frames >= 40:
break
result = calibrator.calibrate((cam.width, cam.height))
save_yaml(result, "calibration.yaml")
Generating calibration patterns
Print your own board at the correct physical size using the generate command.
The --dpi flag controls output resolution (300 is print-ready); the --output / -o
flag sets the filename — the extension determines the image format (.png, .tiff, .pdf, …).
# Checkerboard — 9x6 inner corners, 25 mm squares
calicam generate checkerboard --cols 9 --rows 6 --square-size 25 -o board.png
# ChArUco — 5x7 squares, embedded 5x5 ArUco markers
calicam generate charuco --cols 5 --rows 7 --square-size 30 --marker-size 22 -o charuco.png
# Asymmetric circle grid — 4 columns, 11 rows
calicam generate circles --cols 4 --rows 11 --spacing 20 --radius 5 -o circles.png
All commands report the output dimensions in both pixels and millimetres so you can verify the print size before sending to a printer.
| Pattern | Best for |
|---|---|
checkerboard |
General use; the default for calicam gui |
charuco |
Partial occlusion, longer range, multi-camera |
circles |
Scenes with low texture; sub-pixel accuracy |
Tips
- Use a flat, rigid checkerboard. Print on matte paper, mount on a hard surface.
- Aim for 20–40 frames covering the full image area — tilt and rotate the board.
- A reprojection error below 0.5 px is excellent; below 1.0 px is acceptable.
- If the error stays high, try removing outlier frames and recalibrating (Reset → recapture).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file calicam-0.1.0.tar.gz.
File metadata
- Download URL: calicam-0.1.0.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36fa59a3015221c60fe894bb758d57e0ab8581409f1b71c0e9a790dd4ce70cf2
|
|
| MD5 |
8d7f3f2d28985f65b8ff930921692c30
|
|
| BLAKE2b-256 |
257f0847c1a266c9ce4886b76f83f8f67745d8bb639634b941e28c3dbaeb1af8
|
Provenance
The following attestation bundles were made for calicam-0.1.0.tar.gz:
Publisher:
publish.yml on roaldarbol/calicam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
calicam-0.1.0.tar.gz -
Subject digest:
36fa59a3015221c60fe894bb758d57e0ab8581409f1b71c0e9a790dd4ce70cf2 - Sigstore transparency entry: 1084459283
- Sigstore integration time:
-
Permalink:
roaldarbol/calicam@f928de1a1fa9ffd086a49a7ddb262d10280606ad -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/roaldarbol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f928de1a1fa9ffd086a49a7ddb262d10280606ad -
Trigger Event:
push
-
Statement type:
File details
Details for the file calicam-0.1.0-py3-none-any.whl.
File metadata
- Download URL: calicam-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
529697d72ddfe77ebf1f92aa398d58f25b5a371ac54be61793633fcd720b1b4b
|
|
| MD5 |
126940ffee340a6ff11e82db30d31e4c
|
|
| BLAKE2b-256 |
d2dca37935328257b3ba54a284d05553556453bd19703deed83d0645afbc8622
|
Provenance
The following attestation bundles were made for calicam-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on roaldarbol/calicam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
calicam-0.1.0-py3-none-any.whl -
Subject digest:
529697d72ddfe77ebf1f92aa398d58f25b5a371ac54be61793633fcd720b1b4b - Sigstore transparency entry: 1084459380
- Sigstore integration time:
-
Permalink:
roaldarbol/calicam@f928de1a1fa9ffd086a49a7ddb262d10280606ad -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/roaldarbol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f928de1a1fa9ffd086a49a7ddb262d10280606ad -
Trigger Event:
push
-
Statement type: