calibrel
0.2
More Accurate Pinhole Camera Calibration with Imperfect Planar Target
|
Namespace calrel. More...
Functions | |
double | calibrateCamera (InputArrayOfArrays imagePoints, Size imageSize, InputArray objectPoints, int fixedObjPt, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, OutputArray newObjPoints, OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics, OutputArray stdDeviationsObjectPoints, OutputArray perViewErrors, int flags=0, TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 60, DBL_EPSILON *30)) |
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern. More... | |
double | calibrateCamera (InputArrayOfArrays imagePoints, Size imageSize, InputArray objectPoints, int fixedObjPt, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, OutputArray newObjPoints, int flags=0, TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 60, DBL_EPSILON *30)) |
Namespace calrel.
double calrel::calibrateCamera | ( | InputArrayOfArrays | imagePoints, |
Size | imageSize, | ||
InputArray | objectPoints, | ||
int | fixedObjPt, | ||
InputOutputArray | cameraMatrix, | ||
InputOutputArray | distCoeffs, | ||
OutputArrayOfArrays | rvecs, | ||
OutputArrayOfArrays | tvecs, | ||
OutputArray | newObjPoints, | ||
OutputArray | stdDeviationsIntrinsics, | ||
OutputArray | stdDeviationsExtrinsics, | ||
OutputArray | stdDeviationsObjectPoints, | ||
OutputArray | perViewErrors, | ||
int | flags = 0 , |
||
TermCriteria | criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 60, DBL_EPSILON *30) |
||
) |
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
imagePoints | It is a vector of vectors of the projections of calibration pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints[i].size() must be equal to objectPoints.size() for each i. |
imageSize | Size of the image used only to initialize the intrinsic camera matrix. |
objectPoints | It is a vector of calibration pattern points in the calibration pattern coordinate space (e.g. std::vector<cv::Vec3f>). The same calibration pattern must be shown in each view and it is fully visible. The points are 3D, but since they are in a pattern coordinate system, then, if the rig is planar, it may make sense to put the model to a XY coordinate plane so that Z-coordinate of each input object point is 0. On output, the refined pattern points are returned for imperfect planar target. |
fixedObjPt | The index of the 3D object point to be set as (d, 0, 0) as in Strobl's paper. Usually it is the top-right corner point of the calibration board grid. |
cameraMatrix | Output 3x3 floating-point camera matrix \(\begin{bmatrix} f_x & 0 & c_x\\ 0 & f_y & c_y\\ 0 & 0 & 1 \end{bmatrix}\). If CV_CALIB_USE_INTRINSIC_GUESS and/or CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be initialized before calling the function. |
distCoeffs | Output vector of distortion coefficients \((k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\) of 4, 5, 8, 12 or 14 elements. |
rvecs | Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view (e.g. std::vector<cv::Mat>>). 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. |
newObjPoints | The updated output vector of pattern points. |
stdDeviationsIntrinsics | Output vector of standard deviations estimated for intrinsic parameters. Order of deviations values: \((f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6, s_1, s_2, s_3, s_4, \tau_x, \tau_y)\) If one of parameters is not estimated, it's deviation is equals to zero. |
stdDeviationsExtrinsics | Output vector of standard deviations estimated for extrinsic parameters. Order of deviations values: \((R_1, T_1, \dotsc , R_M, T_M)\) where M is number of pattern views, \(R_i, T_i\) are concatenated 1x3 vectors. |
stdDeviationsObjectPoints | Output vector of standard deviations estimated for refined coordinates of calibration pattern points. It has the same size and order as objectPoints vector. |
perViewErrors | Output vector of the RMS re-projection error estimated for each pattern view. |
flags | Different flags that may be zero or a combination of the following values:
|
criteria | Termination criteria for the iterative optimization algorithm. |
The function estimates the intrinsic camera parameters and extrinsic parameters for each of the views. The algorithm is based on Klaus H. Strobl and Gerd Hirzinger's paper "More Accurate Pinhole Camera Calibration with Imperfect Planar Target". The coordinates of 3D object points and their corresponding 2D projections in each view must be specified. That may be achieved by using an object with a known geometry and easily detectable feature points. Such an object is called a calibration rig or calibration pattern. Currently, initialization of intrinsic parameters (when CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration patterns (where Z-coordinates of the object points must be all zeros).
The algorithm performs the following steps:
double calrel::calibrateCamera | ( | InputArrayOfArrays | imagePoints, |
Size | imageSize, | ||
InputArray | objectPoints, | ||
int | fixedObjPt, | ||
InputOutputArray | cameraMatrix, | ||
InputOutputArray | distCoeffs, | ||
OutputArrayOfArrays | rvecs, | ||
OutputArrayOfArrays | tvecs, | ||
OutputArray | newObjPoints, | ||
int | flags = 0 , |
||
TermCriteria | criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 60, DBL_EPSILON *30) |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.