solveP3P
import { solveP3P } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Finds an object pose {}^{c}\mathbf{T}_o from 3 3D-2D point correspondences.
{ width=50% }
See: calib3d_solvePnP
Note: The solutions are sorted by reprojection errors (lowest to highest).
solveP3P(objectPoints: Mat, imagePoints: Mat, cameraMatrix: Mat, distCoeffs: Mat, rvecs: MatVector, tvecs: MatVector, flags: number): number;objectPointsArray of object points in the object coordinate space, 3x3 1-channel or 1x3/3x1 3-channel. vector<Point3f> can be also passed here.
imagePointsArray of corresponding image points, 3x2 1-channel or 1x3/3x1 2-channel. vector<Point2f> can be also passed here.
cameraMatrixInput camera intrinsic matrix
\cameramatrix{A}.distCoeffsInput vector of distortion coefficients
\distcoeffs. If the vector is NULL/empty, the zero distortion coefficients are assumed.rvecsOutput destination, filled by the native operation. Output rotation vectors (see
Rodrigues) that, together with tvecs, brings points from the model coordinate system to the camera coordinate system. A P3P problem has up to 4 solutions.tvecsOutput destination, filled by the native operation. Output translation vectors.
flagsMethod for solving a P3P problem:
SOLVEPNP_P3PMethod is based on the paper of Ding, Y., Yang, J., Larsson, V., Olsson, C., & Åstrom, K. "Revisiting the P3P Problem" ([ding2023revisiting]).SOLVEPNP_AP3PMethod is based on the paper of T. Ke and S. Roumeliotis. "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" ([Ke17]).
The function estimates the object pose given 3 object points, their corresponding image projections, as well as the camera intrinsic matrix and the distortion coefficients.
The number result.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.