Perspective-n-point pose
Estimate a camera-relative object pose from known 3D points and their 2D image observations.
The shape is known in object coordinates. One calibrated camera sees it at an unknown pose.
The numbered 2D observations correspond to the eight known 3D vertices. Point order must agree between the two arrays.
The trial pose projects the cube to the wrong locations. Orange residuals point from predictions to observations.
The final illustrative pose projects the model onto the observed points. A native PnP result must still be checked for depth and reprojection error.
Refine and inspect reprojection errors; use robust sampling when correspondences contain outliers.
Illustrative example. The stages explain the method; they are not a live OpenCV execution.
Try it on an image
Experiment at pixel level
Solve camera pose from four coplanar object corners and their image positions. Edit normalized image points to match a planar square in your photo; orange points show reprojection.
The engine loads on your first run. Your images stay in this browser.
Scroll over either image to zoom at the pointer. Use the scrollbars to pan both views over the same relative area. Zoom is relative to the input; pixel coordinates belong to each image. Warps can change scene correspondence.
Pixel inspector RGBA · native values · matched scale · 9 × 9 output pixels
Select a pixel
Select a pixel
When to use it
Place an overlay on a calibrated marker or measure the pose of known geometry.
How it works
- 01Match 3D object coordinates to image points.
- 02Solve a rotation and translation consistent with the camera model.
- 03Refine and inspect reprojection errors; use robust sampling when correspondences contain outliers.
camera point = R · object point + t
What to tune
flags select the solver with its minimum point count and geometry requirements. RANSAC thresholds use image coordinates.
Where it breaks down
Some configurations have multiple pose solutions. Units, point order, camera calibration and coordinate conventions must agree.
TypeScript API
Open an entry for its exact overloads, parameter descriptions, result ownership and pinned upstream source.
All of these calls execute on the CPU. Native objects need explicit disposal. See matrices and ownership and build compatibility.
Related methods
Camera calibration
Estimate a camera’s intrinsic parameters and lens distortion from known target geometry.
Lens undistortion
Invert a calibrated lens model to map distorted observations onto an idealized camera image.
Fundamental and essential matrices
Constrain where a point from one camera view can appear in another.
Stereo block matching
Find horizontal correspondences between rectified stereo images using local block similarity.