Abstract
Single image camera calibration is the task of estimating camera parameters—such as vanishing points, focal length, and the horizon line—from a single input image. We propose Camera calibration TRansformer with Line-Classification (CTRL-C), an end-to-end neural network-based approach that directly estimates these parameters from an image and a set of line segments. Our network utilizes a transformer architecture to capture the global structure of an image with multi-modal inputs. We also introduce an auxiliary task of line classification to effectively extract global geometric information. Experiments demonstrate that CTRL-C outperforms previous state-of-the-art methods on the Google Street View (GSV) and SUN360 benchmarks.
Introduction
Camera calibration is a foundational task in computer vision, essential for applications ranging from augmented reality to autonomous navigation. Estimating intrinsic parameters (like focal length) and extrinsic parameters (like orientation) from a single image is notoriously difficult. Traditional methods often rely on detecting line segments and using robust estimators like RANSAC to find vanishing points (VPs), but these are brittle and sensitive to noise. While recent deep learning approaches using Convolutional Neural Networks (CNNs) have improved performance, they often struggle to capture long-range geometric dependencies—such as parallel lines meeting at a distant vanishing point—and rarely integrate explicit geometric features in an end-to-end, learnable manner.
Methodology
CTRL-C addresses these challenges by treating image pixels and detected line segments as multi-modal inputs within a Transformer framework. The architecture is built on three main pillars:
1. Multi-modal Transformer
The model employs a Transformer encoder-decoder architecture. The encoder processes semantic features extracted from a ResNet backbone. The decoder then utilizes "learned queries" for camera parameters, attending to both the image features and geometric tokens derived from line segments detected via the Line Segment Detector (LSD) algorithm.
2. Line Embedding and Auxiliary Classification
Detected line segments are converted into d-dimensional embeddings, allowing the network to explicitly perceive the edges defining the scene's perspective. A key innovation is the Auxiliary Line-Classification Task. During training, the network is tasked with classifying whether a line segment converges toward the zenith (vertical) VP or the horizontal VPs. This forces the Transformer to internalize the geometric relationship between local lines and global camera parameters.
Key Insights
- Transformers for Geometry: Because Transformers use self-attention to relate every part of the input to every other part, they are inherently better suited for capturing long-distance geometric relationships than the local filters of a CNN.
- Geometric Supervision: The auxiliary classification task provides a "hint" to the network, guiding it to understand why certain lines are important for calibration.
- End-to-End Synergy: Unlike previous methods that used lines in separate post-processing steps, CTRL-C integrates them into the core neural network, allowing the model to learn the optimal combination of pixel-level textures and line-level geometry.
Experimental Results
CTRL-C significantly outperformed previous state-of-the-art (SotA) methods like GPNet and UprightNet across multiple benchmarks:
- Horizon Line Accuracy: On the GSV dataset, the Area Under the Curve (AUC) for horizon line estimation improved from 83.12% to 87.29%.
- Error Reduction: The model reduced mean errors in the "Up Direction" and "Pitch" by approximately 15-17% and slashed the Field-of-View (FoV) error by over 40% compared to GPNet on the GSV benchmark.
- Generalization: When trained on SUN360 and tested on HoliCity, CTRL-C maintained superior performance, demonstrating robust generalization capabilities across different environments.
Conclusion
CTRL-C represents a significant step forward in single-image camera calibration by effectively combining semantic image features with explicit geometric line data through a Transformer architecture. While the model currently relies on initial line detection (LSD), which may be sparse in natural scenes, its end-to-end nature and auxiliary supervision provide a robust framework for geometric understanding. Future work may explore self-supervised pre-training to further enhance generalization in environments with limited man-made structures.
Summary updated