DSR: Direct Self-Rectification for Uncalibrated Dual-Lens Cameras

Ruichao Xiao, Wenxiu Sun, Jiahao Pang, Qiong Yan, Jimmy S. J. Ren

Introduction

Generating depth-based effects like synthetic defocus (bokeh) on modern smartphones requires precise stereo matching between dual-lens cameras. For this process to be computationally efficient and accurate, the captured images must be rectified—transformed so that corresponding points lie on the same horizontal scan-line. Traditionally, this relies on factory-set offline calibration. However, these parameters are fragile, often degrading over time due to thermal expansion, physical drops, or mechanical shifts.

Direct Self-rectification (DSR) addresses these challenges by providing a fast, calibration-free method for aligning stereo images on-the-fly. By adopting a "Master-Slave" approach, DSR achieves superior alignment accuracy while maintaining zero distortion in the primary view.

The Self-Rectification Problem

Existing self-rectification methods typically warp both images in a stereo pair. This introduces two significant drawbacks for mobile photography:

  1. Geometric Distortion: Warping the primary image (the one the user intends to keep) degrades optical quality.
  2. Undefined Regions: Dual-warping often creates black borders or "wedges" that necessitate cropping, thereby reducing the effective field of view.

The DSR Methodology

DSR operates on a small-drift assumption, recognizing that smartphone cameras are physically fixed and mostly parallel, meaning misalignments are generally minor. Instead of estimating complex epipolar geometry, DSR treats rectification as a direct coordinate regression problem.

Visual demonstration of vertical alignment between master and slave images.

The process involves four key steps applied exclusively to the "slave" image:

  1. Feature Matching: Detecting and matching keypoints using BRIEF features.
  2. Vertical Alignment ($H_y$): Using RANSAC and multi-variable regression to find a homography that minimizes vertical displacement.
  3. Shearing Transformation ($H_s$): Applying a shearing matrix to preserve the aspect ratio and perpendicularity of the image boundaries, preventing a "squashed" appearance.
  4. Horizontal Shifting ($H_k$): Shifting the image to ensure maximum disparity is zero, simplifying subsequent stereo matching.

By keeping the "master" image untouched, DSR ensures the final photograph retains its original optical integrity.

Evaluation and Results

The researchers evaluated DSR using a synthetic dataset of 1,000 stereo pairs and a realistic dataset captured with dual-lens smartphones in real-world scenarios.

End-to-end pipeline showing original image, rectified crops, and the resulting depth map.

Key Performance Metrics:

  • Accuracy: On the realistic dataset, DSR achieved a Percentage of Aligned Points (PAP) of 83.24% (within a 1-pixel error margin), vastly outperforming standard calibrated rectification, which managed only 28.11%.
  • Distortion: The Normalized Vertex Distance (NVD) was 0.0000 for the master image, confirming zero primary-view distortion.
  • Efficiency: The homography estimation took just 0.63ms on a desktop CPU—approximately 100x faster than competing self-rectification algorithms.

Conclusion

DSR provides a robust and highly efficient solution for the calibration drift common in mobile dual-lens systems. While it is designed for small-drift scenarios and requires textured scenes for feature matching, its speed and preservation of the master image make it an ideal pre-processing step for real-time depth effects, portrait relighting, and 3D segmentation on mobile devices.

Summary updated

Abstract

With the developments of dual-lens camera modules, depth information representing the third dimension of the captured scenes becomes available for smartphones. It is estimated by stereo matching algorithms, taking as input the two views captured by dual-lens cameras at slightly different viewpoints. Depth-of-field rendering (also be referred to as synthetic defocus or bokeh) is one of the trending depth-based applications. However, to achieve fast depth estimation on smartphones, the stereo pairs need to be rectified in the first place. In this paper, we propose a cost-effective solution to perform stereo rectification for dual-lens cameras called direct self-rectification, short for DSR. It removes the need of individual offline calibration for every pair of dual-lens cameras. In addition, the proposed solution is robust to the slight movements, {\it e.g.}, due to collisions, of the dual-lens cameras after fabrication. Different with existing self-rectification approaches, our approach computes the homography in a novel way with zero geometric distortions introduced to the master image. It is achieved by directly minimizing the vertical displacements of corresponding points between the original master image and the transformed slave image. Our method is evaluated on both realistic and synthetic stereo image pairs, and produces superior results compared to the calibrated rectification or other self-rectification approaches.
BibTeX
@inproceedings{xiao2018dsr,
  author = {Ruichao Xiao and Wenxiu Sun and Jiahao Pang and Qiong Yan and Jimmy S. J. Ren},
  title = {{DSR: Direct Self-Rectification for Uncalibrated Dual-Lens Cameras}},
  booktitle = {3DV},
  year = {2018},
  url = {https://openreview.net/forum?id=8OGi1LRhFp},
}
Figure