Skip to content

fisheye_solvePnP

geometryfunctionOpenCV 5.0.0
import { fisheye_solvePnP } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSobjectPoints, imagePoints, cameraMatrix, distCoeffs
FUNCTIONfisheye_solvePnP
RETURN TYPEboolean
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Finds an object pose from 3D-2D point correspondences for fisheye camera model.

fisheye_solvePnP(objectPoints: Mat, imagePoints: Mat, cameraMatrix: Mat, distCoeffs: Mat, rvec: Mat, tvec: Mat, useExtrinsicGuess: boolean, flags: number, criteria: TermCriteria): boolean;
4 available overloads
fisheye_solvePnP(objectPoints: Mat, imagePoints: Mat, cameraMatrix: Mat, distCoeffs: Mat, rvec: Mat, tvec: Mat): boolean;
fisheye_solvePnP(objectPoints: Mat, imagePoints: Mat, cameraMatrix: Mat, distCoeffs: Mat, rvec: Mat, tvec: Mat, useExtrinsicGuess: boolean): boolean;
fisheye_solvePnP(objectPoints: Mat, imagePoints: Mat, cameraMatrix: Mat, distCoeffs: Mat, rvec: Mat, tvec: Mat, useExtrinsicGuess: boolean, flags: number): boolean;
fisheye_solvePnP(objectPoints: Mat, imagePoints: Mat, cameraMatrix: Mat, distCoeffs: Mat, rvec: Mat, tvec: Mat, useExtrinsicGuess: boolean, flags: number, criteria: TermCriteria): boolean;
objectPoints

Array of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. vector<Point3d> can also be passed here.

imagePoints

Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. vector<Point2d> can also be passed here.

cameraMatrix

Input camera intrinsic matrix \cameramatrix{A} .

distCoeffs

Input vector of distortion coefficients (4x1/1x4).

rvec

Output destination, filled by the native operation. Output rotation vector (see Rodrigues ) that, together with tvec, brings points from the model coordinate system to the camera coordinate system.

tvec

Output destination, filled by the native operation. Output translation vector.

useExtrinsicGuess

Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses the provided rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further optimizes them.

flags

Method for solving a PnP problem: see calib3d_solvePnP_flags This function returns the rotation and the translation vectors that transform a 3D point expressed in the object coordinate frame to the camera coordinate frame, using different methods:

  • P3P methods (SOLVEPNP_P3P, SOLVEPNP_AP3P): need 4 input points to return a unique solution.
  • SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar.
  • SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation. Number of input points must be 4. Object points must be defined in the following order:
  • point 0: [-squareLength / 2, squareLength / 2, 0]
  • point 1: [ squareLength / 2, squareLength / 2, 0]
  • point 2: [ squareLength / 2, -squareLength / 2, 0]
  • point 3: [-squareLength / 2, -squareLength / 2, 0]
  • for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
criteria

Termination criteria for internal undistortPoints call. The function internally undistorts points with undistortPoints and call cv::solvePnP, thus the input are very similar. Check there and Perspective-n-Points is described in calib3d_solvePnP for more information.

Returns

The boolean 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.