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:
- Geometric Distortion: Warping the primary image (the one the user intends to keep) degrades optical quality.
- 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.
The process involves four key steps applied exclusively to the "slave" image:
- Feature Matching: Detecting and matching keypoints using BRIEF features.
- Vertical Alignment ($H_y$): Using RANSAC and multi-variable regression to find a homography that minimizes vertical displacement.
- Shearing Transformation ($H_s$): Applying a shearing matrix to preserve the aspect ratio and perpendicularity of the image boundaries, preventing a "squashed" appearance.
- 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.
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