cvg/GeoCalib

GeoCalib: Learning Single-image Calibration with Geometric Optimization (ECCV 2024)

GeoCalib – Single‑image Camera Calibration

What it does
GeoCalib estimates a camera’s intrinsic parameters (focal length, optional lens distortion) and the direction of gravity (i.e., the world‑up vector) from just one RGB image. It combines a deep‑learning backbone that predicts an initial guess with a geometric optimisation step that refines the parameters to satisfy projective constraints.

Why it matters
Accurate intrinsics and a known gravity direction are essential for many downstream tasks such as 3‑D reconstruction, AR/VR, robotics, and autonomous navigation. Traditionally you need a calibration pattern or multiple images; GeoCalib removes that requirement, making on‑the‑fly calibration feasible for handheld devices, drones, or robots that only capture a single frame.

Key components

  • geocalib Python package – lightweight inference library (Python ≥ 3.9, optional CUDA). Provides a GeoCalib class with methods load_image and calibrate.
  • Camera models – supports four models:
    1. pinhole (focal lengths only)
    2. simple_radial (one distortion coefficient k1)
    3. radial (two coefficients k1, k2)
    4. simple_divisional (fisheye‑style single coefficient)
  • Partial / multi‑image support – you can feed known intrinsics or gravity as priors, calibrate batches sharing the same intrinsics, or calibrate rigs of rigidly mounted cameras.
  • Training & evaluation framework – built on the siclib library. Includes scripts to train on the new OpenPano dataset (≈ 2.8 k panoramas → ~37 k cropped views) and to evaluate on several benchmarks (LaMAR, MegaDepth, TartanAir, Stanford2D3D).

How to try it

# install the package (editable mode)
git clone https://github.com/cvg/GeoCalib.git && cd GeoCalib
pip install -e .

# simple inference
python - <<'PY'
import torch
from geocalib import GeoCalib
model = GeoCalib().to('cuda' if torch.cuda.is_available() else 'cpu')
img = model.load_image('my_picture.jpg').to(model.device)
out = model.calibrate(img)
print('camera intrinsics:', out['camera'])
print('gravity direction:', out['gravity'])
PY

A ready‑to‑run Colab notebook and a Gradio web demo are also linked from the README.

Training data – OpenPano

  • Combines HDR panoramas from HDRMAPS, PolyHaven, and the Laval indoor HDR dataset.
  • After tonemapping and optional distortion simulation, the pipeline creates ~37 k training crops, plus validation and test splits.
  • Scripts (siclib.datasets.create_dataset_from_pano) handle download, tonemapping, and dataset generation.

Performance (Area‑Under‑Curve, 1°/5°/10° error thresholds) on four public benchmarks – GeoCalib consistently outperforms prior methods such as DeepCalib, ParamNet, and UVP, especially on roll and pitch estimation.

Typical use‑cases

  • Robotics / drones – calibrate a new camera on‑board without a calibration board.
  • AR/VR – quickly obtain intrinsics for handheld phones or head‑mounted displays.
  • Structure‑from‑motion pipelines – provide a good initial guess for bundle adjustment when only a single view is available.

Where to go next

  • Experiment with different camera models via the camera_model argument.
  • Supply priors (known focal length, known gravity) to improve robustness in constrained scenarios.
  • Extend the Camera class to add custom distortion models.
  • Use the provided evaluation scripts to benchmark on your own dataset.

All information above is taken directly from the repository’s README.

Related

  • Project
  • Project
  • Project
  • Project
  • Project