# An Accurate, Efficient, and Stable Perspective-n-Point Algorithm in 3D Space
### Problems with Existing PnP Algorithms and Solutions  
The above demonstrates that, among the PnP algorithms, except for the RDLT algorithm, the linear solution method is not as efficient, accurate, and stable as the non-linear solution method. The non-linear method, for solutions, adopts Gauss-Newton method, the  
Figure 1: Schematic diagram of Gröbner generation framework.  
Lavenberg-Marquardt method for iteration, the orthogonal iteration method, and other iterative algorithms to solve the PnP problem. However, the selection of the initial value affects the accuracy, stability, and computational efficiency of the algorithms, which explains their less favorable performance compared with the non-iterative method. Among non-iterative methods, the PnP algorithm, with the best performance, introduces CGR (Cayley-Gibbs-Rodriguez) to parameterize the rotation matrix, and utilizes the parametrization of the imaging model equation to translate the vector. The Grobner is employed to solve pose parameters, which avoids lengthy computational duration and local optimum caused by the unreasonable initial values of the iterative method. Instead, the polynomial sets formed by the PnP problem, are generally rather complex, and the application of the Grobner technique to solve the polynomial sets requires the construction of a large elimination template matrix, which enlarges the computational burden to solve the PnP problem, and affects the real-time performance of the PnP algorithm in practical applications. In order to make up for the shortcomings of the above methods, and to improve the robustness, accuracy, efficiency, and universality of the PnP algorithm, this paper proposes the Hidden PnP, a method to solve polynomial sets based on hidden variables, which guarantees higher accuracy, stability, and efficiency in solving the PnP problem. The main contributions of this paper are as follows:  
1. To prevent singularities in the rotation matrix parametrized by the CGR, a rotation matrix, R1, is constructed, and the rotation matrix, R, parametrized by the CGR is processed using R1.
2. In this paper, accuracy experiments and noise immunity experiments of the hidden variable method were carried out in three cases, i.e., Planar Case, Ordinary 3D and Quasi-Singular. The performance of some new PnP algorithms in recent years were compared and detailed experimental data given.
3. In this paper, the hidden variable-based PnP algorithm, and other PnP algorithms, were applied to the physical experiments with monocular vision cameras, and re-projection experiments of the corner points of calibration plates were carried out. In addition, detailed reprojection experimental error data for each PnP algorithm are given.  
In the second section, the basic mathematical description of the PnP problem is given and the mathematical solution process of the hidden variables is described in detail. In the third section, simulation experiments and results analysis are carried out on Matlab software using synthetic data. In this section, the posited solution performance of the proposed hidden PnP method is compared with our Hidden PnP method in three cases, namely the Ordinary 3D case, the Planar Case and the Quasi-Singular case, as well as in the case of noise under these three cases. In addition, the section gives experimental data comparing the operational efficiency of various algorithms, and, finally, the algorithms are applied to the physical experiment of the reprojection error. Section 4 presents the conclusions and outlook.