CLI Reference¶
AquaCal provides three command-line tools for calibration workflows. All values are in meters.
aquacal calibrate¶
Run the complete calibration pipeline from a configuration file.
Syntax:
aquacal calibrate <config_path> [options]
Arguments:
Argument |
Type |
Description |
|---|---|---|
|
Path |
Path to configuration YAML file (required) |
Options:
Flag |
Description |
|---|---|
|
Enable verbose output showing optimizer iteration details |
|
Override the output directory specified in config |
|
Validate configuration file without running calibration |
Examples:
# Run calibration with default settings
aquacal calibrate config.yaml
# Run with verbose output to see optimizer progress
aquacal calibrate config.yaml -v
# Validate config without running calibration
aquacal calibrate config.yaml --dry-run
# Override output directory
aquacal calibrate config.yaml -o /path/to/output
Exit Codes:
0: Success1: File not found or I/O error2: Invalid configuration3: Calibration failed (e.g., insufficient data, optimization divergence)130: User interrupt (Ctrl+C)
aquacal init¶
Generate a configuration file by scanning video directories.
Syntax:
aquacal init --intrinsic-dir PATH --extrinsic-dir PATH [options]
Required Options:
Flag |
Type |
Description |
|---|---|---|
|
Path |
Directory containing in-air calibration videos |
|
Path |
Directory containing underwater calibration videos |
Optional Flags:
Flag |
Default |
Description |
|---|---|---|
|
|
Output path for generated config file |
|
|
Regex with one capture group to extract camera name from filename stem |
How It Works:
Scans both directories for video files (
.mp4,.avi,.mov,.mkv)Extracts camera names from filenames using the regex pattern (default: entire filename stem)
Matches cameras between intrinsic and extrinsic directories
Generates a config YAML with placeholder board parameters and matched video paths
Examples:
# Basic usage with default pattern
aquacal init --intrinsic-dir videos/in_air --extrinsic-dir videos/underwater
# Extract camera names from filenames like "camera_cam0_inair.mp4" → "cam0"
aquacal init --intrinsic-dir in_air/ --extrinsic-dir underwater/ --pattern "camera_(.+)_"
# Custom output path
aquacal init --intrinsic-dir in_air/ --extrinsic-dir underwater/ -o my_config.yaml
Camera Name Extraction:
The --pattern regex must have exactly one capture group. For example:
Filename |
Pattern |
Extracted Name |
|---|---|---|
|
|
|
|
|
|
|
|
|
Exit Codes:
0: Success1: Directory not found, no videos found, no common cameras, or invalid regex pattern
aquacal compare¶
Compare multiple calibration runs and generate diagnostic reports.
Syntax:
aquacal compare <dir1> <dir2> [dir3 ...] [options]
Arguments:
Argument |
Type |
Description |
|---|---|---|
|
Paths |
Two or more directories containing |
Options:
Flag |
Default |
Description |
|---|---|---|
|
|
Output directory for comparison results |
|
False |
Skip PNG plot generation (only generate CSV files) |
Output Files:
The command generates:
metrics.csv— Overall metrics (RMS, camera counts) for each runper_camera.csv— Per-camera metrics across all runsparameter_diffs.csv— Pairwise differences in extrinsics and water_zrms_bar_chart.png— Bar chart comparing RMS reprojection errorsposition_overlay.png— 3D scatter plot of camera positions across runsz_position_dumbbell.png— Camera Z-positions with connecting lines between runsdepth_error_plot.png— (if spatial_measurements.csv exists) Error vs. depth analysisdepth_binned.csv— (if spatial data available) Binned error statistics
Examples:
# Compare two calibration runs
aquacal compare output_run1/ output_run2/
# Compare three runs with custom output directory
aquacal compare run1/ run2/ run3/ -o comparison_results/
# Generate only CSV files (no plots)
aquacal compare run1/ run2/ --no-plots
Exit Codes:
0: Success1: Directory not found, calibration.json missing, or I/O error2: Comparison failed (e.g., incompatible camera sets)
Global Options¶
Flag |
Description |
|---|---|
|
Display AquaCal version and exit |
Example:
aquacal --version
# Output: aquacal 0.1.0
Configuration File Format¶
All three commands work with YAML configuration files. The init command generates a template config with:
board: ChArUco board parameters (squares_x, squares_y, square_size, marker_size, dictionary)
cameras: List of camera names (first camera is the reference camera, world origin)
paths: Intrinsic and extrinsic video paths per camera
interface: Refractive indices and optional initial water_z estimates
optimization: Robust loss settings, max frames, intrinsic refinement flags
detection: Corner detection thresholds and frame sampling
validation: Holdout fraction for validation set
After running init, you must edit the generated config to:
Set accurate board dimensions (measure your physical board)
Optionally add
initial_water_zestimates per camera (improves Stage 3 initialization)Configure
auxiliary_cameras,rational_model_cameras, orfisheye_camerasif needed
See the User Guide for detailed explanations of calibration theory and the API Reference for programmatic usage.