pub fn calibrate(
object_points: &impl ToInputArray,
image_points: &impl ToInputArray,
image_size: Size,
k: &mut impl ToInputOutputArray,
d: &mut impl ToInputOutputArray,
rvecs: &mut impl ToOutputArray,
tvecs: &mut impl ToOutputArray,
flags: i32,
criteria: TermCriteria,
) -> Result<f64>Expand description
Performs camera calibration
§Parameters
- objectPoints: vector of vectors of calibration pattern points in the calibration pattern coordinate space.
- imagePoints: vector of vectors of the projections of calibration pattern points. imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to objectPoints[i].size() for each i.
- image_size: Size of the image used only to initialize the camera intrinsic matrix.
- K: Output 3x3 floating-point camera intrinsic matrix
. If [fisheye::CALIB_USE_INTRINSIC_GUESS] is specified, some or all of fx, fy, cx, cy must be initialized before calling the function.
- D: Output vector of distortion coefficients
.
- rvecs: Output vector of rotation vectors (see [Rodrigues] ) estimated for each pattern view. That is, each k-th rotation vector together with the corresponding k-th translation vector (see the next output parameter description) brings the calibration pattern from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the calibration pattern in the k-th pattern view (k=0.. M -1).
- tvecs: Output vector of translation vectors estimated for each pattern view.
- flags: Different flags that may be zero or a combination of the following values:
- [fisheye::CALIB_USE_INTRINSIC_GUESS] cameraMatrix contains valid initial values of fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image center ( imageSize is used), and focal distances are computed in a least-squares fashion.
- [fisheye::CALIB_RECOMPUTE_EXTRINSIC] Extrinsic will be recomputed after each iteration of intrinsic optimization.
- [fisheye::CALIB_CHECK_COND] The functions will check validity of condition number.
- [fisheye::CALIB_FIX_SKEW] Skew coefficient (alpha) is set to zero and stay zero.
- [fisheye::CALIB_FIX_K1],…, [fisheye::CALIB_FIX_K4] Selected distortion coefficients are set to zeros and stay zero.
- [fisheye::CALIB_FIX_PRINCIPAL_POINT] The principal point is not changed during the global optimization. It stays at the center or at a different location specified when [fisheye::CALIB_USE_INTRINSIC_GUESS] is set too.
- [fisheye::CALIB_FIX_FOCAL_LENGTH] The focal length is not changed during the global
optimization. It is the
or the provided
,
when [fisheye::CALIB_USE_INTRINSIC_GUESS] is set too.
- criteria: Termination criteria for the iterative optimization algorithm.
§C++ default parameters
- flags: 0
- criteria: TermCriteria(TermCriteria::COUNT+TermCriteria::EPS,100,DBL_EPSILON)