project_points_def

Function project_points_def 

Source
pub fn project_points_def(
    object_points: &impl ToInputArray,
    rvec: &impl ToInputArray,
    tvec: &impl ToInputArray,
    camera_matrix: &impl ToInputArray,
    dist_coeffs: &impl ToInputArray,
    image_points: &mut impl ToOutputArray,
) -> Result<()>
Expand description

Projects 3D points to an image plane.

§Parameters

  • objectPoints: Array of object points expressed wrt. the world coordinate frame. A 3xN/Nx3 1-channel or 1xN/Nx1 3-channel (or vector<Point3f> ), where N is the number of points in the view.
  • rvec: The rotation vector ([Rodrigues]) that, together with tvec, performs a change of basis from world to camera coordinate system, see [calibrateCamera] for details.
  • tvec: The translation vector, see parameter description above.
  • cameraMatrix: Camera intrinsic matrix inline formula .
  • distCoeffs: Input vector of distortion coefficients inline formula . If the vector is empty, the zero distortion coefficients are assumed.
  • imagePoints: Output array of image points, 1xN/Nx1 2-channel, or vector<Point2f> .
  • jacobian: Optional output 2Nx(10+<numDistCoeffs>) jacobian matrix of derivatives of image points with respect to components of the rotation vector, translation vector, focal lengths, coordinates of the principal point and the distortion coefficients. In the old interface different components of the jacobian are returned via different output parameters.
  • aspectRatio: Optional “fixed aspect ratio” parameter. If the parameter is not 0, the function assumes that the aspect ratio (inline formula) is fixed and correspondingly adjusts the jacobian matrix.

The function computes the 2D projections of 3D points to the image plane, given intrinsic and extrinsic camera parameters. Optionally, the function computes Jacobians -matrices of partial derivatives of image points coordinates (as functions of all the input parameters) with respect to the particular parameters, intrinsic and/or extrinsic. The Jacobians are used during the global optimization in [calibrateCamera], [solvePnP], and [stereoCalibrate]. The function itself can also be used to compute a re-projection error, given the current intrinsic and extrinsic parameters.

Note: By setting rvec = tvec = inline formula, or by setting cameraMatrix to a 3x3 identity matrix, or by passing zero distortion coefficients, one can get various useful partial cases of the function. This means, one can compute the distorted coordinates for a sparse set of points or apply a perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup.

§Note

This alternative version of project_points function uses the following default values for its arguments:

  • jacobian: noArray()
  • aspect_ratio: 0