Nodes/comfyui_cv/cv2.solvePnPRansac
ComfyUI Node

cv2.solvePnPRansac

Raw wrapper of cv2.solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, useExtrinsicGuess?, iterationsCount?, reprojectionError?, confidence?, flags?). Parameters marked '?' are optional; blank means OpenCV default. See the OpenCV documentation for details.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
cv2.solvePnPRansac
  • objectPoints
  • imagePoints
  • cameraMatrix
  • distCoeffs
  • retval
  • rvec
  • tvec
  • inliers
useExtrinsicGuessfalse
iterationsCount100
reprojectionError8.0000
confidence0.9900
flagsSOLVEPNP_ITERATIVE
Categoryimage/CV/low-level/cv2 S

Inputs (9)

NameTypeDefaultDescription
objectPointsNPARRAYArray of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. vector\ can be also passed here. A data array (points / matrix), NOT an image - only an NPARRAY link is accepted here.
imagePointsNPARRAYArray of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. vector\ can be also passed here. A data array (points / matrix), NOT an image - only an NPARRAY link is accepted here.
cameraMatrixNPARRAYInput camera intrinsic matrix $\cameramatrix{A}$ . A data array (points / matrix), NOT an image - only an NPARRAY link is accepted here.
distCoeffsoptNPARRAYInput vector of distortion coefficients $\distcoeffs$. If the vector is NULL/empty, the zero distortion coefficients are assumed. Optional - leave unconnected for the OpenCV default (None). A data array (points / matrix), NOT an image - only an NPARRAY link is accepted here.
useExtrinsicGuessoptBOOLEANfalseParameter used for . 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. Preset to the OpenCV default (False).
iterationsCountoptINT100-2147483648–2147483647Number of iterations. Preset to the OpenCV default (100).
reprojectionErroroptFLOAT8.0000-1e+38–1e+38Inlier threshold value used by the RANSAC procedure. The parameter value is the maximum allowed distance between the observed and computed point projections to consider it an inlier. Preset to the OpenCV default (8.0).
confidenceoptFLOAT0.9900-1e+38–1e+38The probability that the algorithm produces a useful result. Preset to the OpenCV default (0.99).
flagsoptCOMBOSOLVEPNP_ITERATIVEMethod for solving a PnP problem (see ). The function estimates an object pose given a set of object points, their corresponding image projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such a pose that minimizes reprojection error, that is, the sum of squared distances between the observed projections imagePoints and the projected (using ) objectPoints. The use of RANSAC makes the function resistant to outliers.

Outputs (4)

NameTypeDescription
retvalBOOLEAN
rvecNPARRAY
tvecNPARRAY
inliersNPARRAY