Abstract
The Perspective Three Point (P3P) problem is a fundamental task in computer vision, essential for camera pose estimation in real-time applications. Traditional solvers often rely on quartic polynomials, which can suffer from numerical instability and "ghost" solutions. This paper introduces Lambda Twist, a novel P3P solver that utilizes a stable cubic diagonalization approach. By solving for depths rather than pose directly and leveraging geometric constraints, Lambda Twist achieves superior speed, accuracy, and robustness compared to existing state-of-the-art methods.
Introduction
The P3P problem involves determining the position and orientation (pose) of a camera given three 3D points in the world and their corresponding 2D projections in an image. It is the minimal case of the Perspective-n-Point (PnP) problem and serves as a critical component in systems requiring high-frequency pose updates, such as Augmented Reality (AR), Virtual Reality (VR), and Visual Odometry for autonomous vehicles.
Existing direct solvers typically solve a quartic polynomial to find up to four possible solutions. However, these methods are prone to numerical instability, particularly in near-degenerate configurations where points are nearly collinear. Furthermore, they often produce physically impossible solutions (e.g., points behind the camera) that require post-hoc filtering.
The Lambda Twist Method
Lambda Twist departs from traditional direct pose estimation by first solving for the distances (depths) from the camera center to the three 3D points.
1. Pose Invariant Constraints
The algorithm begins by eliminating rotation and translation variables, resulting in three quadratic equations that define the distances between the points based on the known 3D geometry and observed image rays.
2. The Cubic Twist
Geometrically, the problem is framed as finding the intersection of two ellipses. The authors employ a linear algebra technique to find a specific linear combination of these equations that yields a rank-2 matrix. This step requires solving a cubic polynomial instead of a quartic. Solving for a single root of a cubic is inherently more stable than finding all roots of a quartic, especially when solutions are close together.
3. Diagonalization and Refinement
By diagonalizing the rank-2 matrix, the geometry simplifies into a set of planes, allowing for direct calculation of valid depths. The algorithm uses Newton’s method to find a real root of the cubic and then applies a few iterations of Gauss-Newton optimization to refine the final depths for maximum precision.
Experimental Evaluation
The authors conducted an extensive evaluation using a synthetic dataset of 10 million ($10^7$) random samples. This dataset included a wide range of rotations, translations, and depths, with a specific focus on "near-degenerate" cases to test numerical limits.
Performance Comparison
Lambda Twist was compared against the solvers by Kneip et al. and Ke et al. (the latter being the standard in OpenCV).
- Computational Efficiency: Lambda Twist is the fastest solver, with an average execution time of 278ns per sample, outperforming Ke (342ns) and Kneip (1042ns).
- Numerical Accuracy: It consistently demonstrated lower numerical errors across the 10-million-sample test set.
- Robustness: In the stress test, Lambda Twist failed only 32 times, whereas Ke’s solver failed 4,210 times and Kneip’s failed 5,027 times.
- Solution Integrity: By working with depths directly, the algorithm can discard invalid solutions (negative depths) early, avoiding the "ghost" solutions that often plague direct solvers.
Conclusion
Lambda Twist provides a significant advancement in P3P solving by prioritizing numerical stability and geometric validity. By reducing the problem to a cubic polynomial and focusing on depth estimation, it offers a faster and more robust solution suitable for the most demanding real-time computer vision applications. While the absolute speed gains are measured in nanoseconds, the increased reliability in edge cases makes it a superior choice for robust RANSAC-based pose estimation pipelines.
The implementation and benchmarks are available on GitHub.
Summary updated