mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 09:25:45 +08:00
Unify Pinhole and Fisheye camera calibration flags.
This commit is contained in:
parent
cea26341a5
commit
8595066afc
@ -419,32 +419,37 @@ enum { CALIB_CB_SYMMETRIC_GRID = 1,
|
|||||||
CALIB_CB_CLUSTERING = 4
|
CALIB_CB_CLUSTERING = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { CALIB_NINTRINSIC = 18,
|
#define CALIB_NINTRINSIC 18 //!< Maximal size of camera internal parameters (initrinsics) vector
|
||||||
CALIB_USE_INTRINSIC_GUESS = 0x00001,
|
|
||||||
CALIB_FIX_ASPECT_RATIO = 0x00002,
|
enum { CALIB_USE_INTRINSIC_GUESS = 0x00001, //!< Use user provided intrinsics as initial point for optimization.
|
||||||
CALIB_FIX_PRINCIPAL_POINT = 0x00004,
|
CALIB_FIX_ASPECT_RATIO = 0x00002, //!< Use with CALIB_USE_INTRINSIC_GUESS. The ratio fx/fy stays the same as in the input cameraMatrix.
|
||||||
CALIB_ZERO_TANGENT_DIST = 0x00008,
|
CALIB_FIX_PRINCIPAL_POINT = 0x00004, //!< The principal point (cx, cy) stays the same as in the input camera matrix. Image center is used as principal point, if CALIB_USE_INTRINSIC_GUESS is not set.
|
||||||
CALIB_FIX_FOCAL_LENGTH = 0x00010,
|
CALIB_ZERO_TANGENT_DIST = 0x00008, //!< For pinhole model only. Tangential distortion coefficients \f$(p_1, p_2)\f$ are set to zeros and stay zero.
|
||||||
CALIB_FIX_K1 = 0x00020,
|
CALIB_FIX_FOCAL_LENGTH = 0x00010, //!< Use with CALIB_USE_INTRINSIC_GUESS. The focal length (fx, fy) stays the same as in the input cameraMatrix.
|
||||||
CALIB_FIX_K2 = 0x00040,
|
CALIB_FIX_K1 = 0x00020, //!< The corresponding distortion coefficient is not changed during the optimization. 0 value is used, if CALIB_USE_INTRINSIC_GUESS is not set.
|
||||||
CALIB_FIX_K3 = 0x00080,
|
CALIB_FIX_K2 = 0x00040, //!< The corresponding distortion coefficient is not changed during the optimization. 0 value is used, if CALIB_USE_INTRINSIC_GUESS is not set.
|
||||||
CALIB_FIX_K4 = 0x00800,
|
CALIB_FIX_K3 = 0x00080, //!< The corresponding distortion coefficient is not changed during the optimization. 0 value is used, if CALIB_USE_INTRINSIC_GUESS is not set.
|
||||||
CALIB_FIX_K5 = 0x01000,
|
CALIB_FIX_K4 = 0x00800, //!< The corresponding distortion coefficient is not changed during the optimization. 0 value is used, if CALIB_USE_INTRINSIC_GUESS is not set.
|
||||||
CALIB_FIX_K6 = 0x02000,
|
CALIB_FIX_K5 = 0x01000, //!< For pinhole model only. The corresponding distortion coefficient is not changed during the optimization. 0 value is used, if CALIB_USE_INTRINSIC_GUESS is not set.
|
||||||
CALIB_RATIONAL_MODEL = 0x04000,
|
CALIB_FIX_K6 = 0x02000, //!< For pinhole model only. The corresponding distortion coefficient is not changed during the optimization. 0 value is used, if CALIB_USE_INTRINSIC_GUESS is not set.
|
||||||
CALIB_THIN_PRISM_MODEL = 0x08000,
|
CALIB_RATIONAL_MODEL = 0x04000, //!< For pinhole model only. Use rational distortion model with coefficients k4..k6.
|
||||||
CALIB_FIX_S1_S2_S3_S4 = 0x10000,
|
CALIB_THIN_PRISM_MODEL = 0x08000, //!< For pinhole model only. Use thin prism distortion model with coefficients s1..s4.
|
||||||
CALIB_TILTED_MODEL = 0x40000,
|
CALIB_FIX_S1_S2_S3_S4 = 0x10000, //!< For pinhole model only. The thin prism distortion coefficients are not changed during the optimization. 0 value is used, if CALIB_USE_INTRINSIC_GUESS is not set.
|
||||||
CALIB_FIX_TAUX_TAUY = 0x80000,
|
CALIB_TILTED_MODEL = 0x40000, //!< For pinhole model only. Coefficients tauX and tauY are enabled in camera matrix.
|
||||||
CALIB_USE_QR = 0x100000, //!< use QR instead of SVD decomposition for solving. Faster but potentially less precise
|
CALIB_FIX_TAUX_TAUY = 0x80000, //!< For pinhole model only. The tauX and tauY coefficients are not changed during the optimization. 0 value is used, if CALIB_USE_INTRINSIC_GUESS is not set.
|
||||||
CALIB_FIX_TANGENT_DIST = 0x200000,
|
CALIB_USE_QR = 0x100000, //!< Use QR instead of SVD decomposition for solving. Faster but potentially less precise
|
||||||
|
CALIB_FIX_TANGENT_DIST = 0x200000, //!< For pinhole model only. Tangential distortion coefficients (p1,p2) are set to zeros and stay zero.
|
||||||
// only for stereo
|
// only for stereo
|
||||||
CALIB_FIX_INTRINSIC = 0x00100,
|
CALIB_FIX_INTRINSIC = 0x00100, //!< For stereo and milti-camera calibration only. Do not optimize cameras intrinsics
|
||||||
CALIB_SAME_FOCAL_LENGTH = 0x00200,
|
CALIB_SAME_FOCAL_LENGTH = 0x00200, //!< For stereo calibration only. Use the same focal length for cameras in pair.
|
||||||
// for stereo rectification
|
// for stereo rectification
|
||||||
CALIB_ZERO_DISPARITY = 0x00400,
|
CALIB_ZERO_DISPARITY = 0x00400, //!< For @ref stereoRectify only. See the function description for more details.
|
||||||
CALIB_USE_LU = (1 << 17), //!< use LU instead of SVD decomposition for solving. much faster but potentially less precise
|
CALIB_USE_LU = (1 << 17), //!< use LU instead of SVD decomposition for solving. much faster but potentially less precise
|
||||||
CALIB_USE_EXTRINSIC_GUESS = (1 << 22) //!< for stereoCalibrate
|
CALIB_USE_EXTRINSIC_GUESS = (1 << 22), //!< For stereo calibration only. Use user provided extrinsics (R, T) as initial point for optimization
|
||||||
|
// fisheye only flags
|
||||||
|
CALIB_RECOMPUTE_EXTRINSIC = (1 << 23), //!< For fisheye model only. Recompute board position on each calibration iteration
|
||||||
|
CALIB_CHECK_COND = (1 << 24), //!< For fisheye model only. Check SVD decomposition quality for each frame during extrinsics estimation
|
||||||
|
CALIB_FIX_SKEW = (1 << 25) //!< For fisheye model only. Skew coefficient (alpha) is set to zero and stay zero.
|
||||||
};
|
};
|
||||||
|
|
||||||
enum HandEyeCalibrationMethod
|
enum HandEyeCalibrationMethod
|
||||||
@ -759,7 +764,7 @@ a change of basis from object coordinate space to camera coordinate space. Due t
|
|||||||
tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate
|
tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate
|
||||||
space.
|
space.
|
||||||
@param tvecs Output vector of translation vectors estimated for each pattern view, see parameter
|
@param tvecs Output vector of translation vectors estimated for each pattern view, see parameter
|
||||||
describtion above.
|
description above.
|
||||||
@param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic
|
@param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic
|
||||||
parameters. Order of deviations values:
|
parameters. Order of deviations values:
|
||||||
\f$(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,
|
\f$(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,
|
||||||
@ -1466,20 +1471,20 @@ namespace fisheye
|
|||||||
//! @addtogroup calib3d_fisheye
|
//! @addtogroup calib3d_fisheye
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
enum{
|
// For backward compatibility only!
|
||||||
CALIB_USE_INTRINSIC_GUESS = 1 << 0,
|
// Use unified Pinhole and Fisheye model calibration flags
|
||||||
CALIB_RECOMPUTE_EXTRINSIC = 1 << 1,
|
using cv::CALIB_USE_INTRINSIC_GUESS;
|
||||||
CALIB_CHECK_COND = 1 << 2,
|
using cv::CALIB_RECOMPUTE_EXTRINSIC;
|
||||||
CALIB_FIX_SKEW = 1 << 3,
|
using cv::CALIB_CHECK_COND;
|
||||||
CALIB_FIX_K1 = 1 << 4,
|
using cv::CALIB_FIX_SKEW;
|
||||||
CALIB_FIX_K2 = 1 << 5,
|
using cv::CALIB_FIX_K1;
|
||||||
CALIB_FIX_K3 = 1 << 6,
|
using cv::CALIB_FIX_K2;
|
||||||
CALIB_FIX_K4 = 1 << 7,
|
using cv::CALIB_FIX_K3;
|
||||||
CALIB_FIX_INTRINSIC = 1 << 8,
|
using cv::CALIB_FIX_K4;
|
||||||
CALIB_FIX_PRINCIPAL_POINT = 1 << 9,
|
using cv::CALIB_FIX_INTRINSIC;
|
||||||
CALIB_ZERO_DISPARITY = 1 << 10,
|
using cv::CALIB_FIX_PRINCIPAL_POINT;
|
||||||
CALIB_FIX_FOCAL_LENGTH = 1 << 11
|
using cv::CALIB_ZERO_DISPARITY;
|
||||||
};
|
using cv::CALIB_FIX_FOCAL_LENGTH;
|
||||||
|
|
||||||
/** @brief Projects points using fisheye model
|
/** @brief Projects points using fisheye model
|
||||||
|
|
||||||
@ -1613,7 +1618,7 @@ objectPoints[i].size() for each i.
|
|||||||
@param image_size Size of the image used only to initialize the camera intrinsic matrix.
|
@param image_size Size of the image used only to initialize the camera intrinsic matrix.
|
||||||
@param K Output 3x3 floating-point camera intrinsic matrix
|
@param K Output 3x3 floating-point camera intrinsic matrix
|
||||||
\f$\cameramatrix{A}\f$ . If
|
\f$\cameramatrix{A}\f$ . If
|
||||||
@ref fisheye::CALIB_USE_INTRINSIC_GUESS is specified, some or all of fx, fy, cx, cy must be
|
@ref CALIB_USE_INTRINSIC_GUESS is specified, some or all of fx, fy, cx, cy must be
|
||||||
initialized before calling the function.
|
initialized before calling the function.
|
||||||
@param D Output vector of distortion coefficients \f$\distcoeffsfisheye\f$.
|
@param D Output vector of distortion coefficients \f$\distcoeffsfisheye\f$.
|
||||||
@param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view.
|
@param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view.
|
||||||
@ -1623,19 +1628,19 @@ space (in which object points are specified) to the world coordinate space, that
|
|||||||
position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
|
position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
|
||||||
@param tvecs Output vector of translation vectors estimated for each pattern view.
|
@param tvecs Output vector of translation vectors estimated for each pattern view.
|
||||||
@param flags Different flags that may be zero or a combination of the following values:
|
@param flags Different flags that may be zero or a combination of the following values:
|
||||||
- @ref fisheye::CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
|
- @ref 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
|
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.
|
center ( imageSize is used), and focal distances are computed in a least-squares fashion.
|
||||||
- @ref fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
|
- @ref CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
|
||||||
of intrinsic optimization.
|
of intrinsic optimization.
|
||||||
- @ref fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
|
- @ref CALIB_CHECK_COND The functions will check validity of condition number.
|
||||||
- @ref fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
|
- @ref CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
|
||||||
- @ref fisheye::CALIB_FIX_K1,..., @ref fisheye::CALIB_FIX_K4 Selected distortion coefficients
|
- @ref CALIB_FIX_K1,..., @ref CALIB_FIX_K4 Selected distortion coefficients
|
||||||
are set to zeros and stay zero.
|
are set to zeros and stay zero.
|
||||||
- @ref fisheye::CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
|
- @ref 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 @ref fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
|
optimization. It stays at the center or at a different location specified when @ref CALIB_USE_INTRINSIC_GUESS is set too.
|
||||||
- @ref fisheye::CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global
|
- @ref CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global
|
||||||
optimization. It is the \f$max(width,height)/\pi\f$ or the provided \f$f_x\f$, \f$f_y\f$ when @ref fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
|
optimization. It is the \f$max(width,height)/\pi\f$ or the provided \f$f_x\f$, \f$f_y\f$ when @ref CALIB_USE_INTRINSIC_GUESS is set too.
|
||||||
@param criteria Termination criteria for the iterative optimization algorithm.
|
@param criteria Termination criteria for the iterative optimization algorithm.
|
||||||
*/
|
*/
|
||||||
CV_EXPORTS_W double calibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, const Size& image_size,
|
CV_EXPORTS_W double calibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, const Size& image_size,
|
||||||
@ -1659,7 +1664,7 @@ camera.
|
|||||||
@param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
|
@param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
|
||||||
camera.
|
camera.
|
||||||
@param Q Output \f$4 \times 4\f$ disparity-to-depth mapping matrix (see reprojectImageTo3D ).
|
@param Q Output \f$4 \times 4\f$ disparity-to-depth mapping matrix (see reprojectImageTo3D ).
|
||||||
@param flags Operation flags that may be zero or @ref fisheye::CALIB_ZERO_DISPARITY . If the flag is set,
|
@param flags Operation flags that may be zero or @ref CALIB_ZERO_DISPARITY . If the flag is set,
|
||||||
the function makes the principal points of each camera have the same pixel coordinates in the
|
the function makes the principal points of each camera have the same pixel coordinates in the
|
||||||
rectified views. And if the flag is not set, the function may still shift the images in the
|
rectified views. And if the flag is not set, the function may still shift the images in the
|
||||||
horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
|
horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
|
||||||
@ -1685,7 +1690,7 @@ observed by the first camera.
|
|||||||
observed by the second camera.
|
observed by the second camera.
|
||||||
@param K1 Input/output first camera intrinsic matrix:
|
@param K1 Input/output first camera intrinsic matrix:
|
||||||
\f$\vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}\f$ , \f$j = 0,\, 1\f$ . If
|
\f$\vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}\f$ , \f$j = 0,\, 1\f$ . If
|
||||||
any of @ref fisheye::CALIB_USE_INTRINSIC_GUESS , @ref fisheye::CALIB_FIX_INTRINSIC are specified,
|
any of @ref CALIB_USE_INTRINSIC_GUESS , @ref CALIB_FIX_INTRINSIC are specified,
|
||||||
some or all of the matrix components must be initialized.
|
some or all of the matrix components must be initialized.
|
||||||
@param D1 Input/output vector of distortion coefficients \f$\distcoeffsfisheye\f$ of 4 elements.
|
@param D1 Input/output vector of distortion coefficients \f$\distcoeffsfisheye\f$ of 4 elements.
|
||||||
@param K2 Input/output second camera intrinsic matrix. The parameter is similar to K1 .
|
@param K2 Input/output second camera intrinsic matrix. The parameter is similar to K1 .
|
||||||
@ -1704,28 +1709,28 @@ to camera coordinate space of the first camera of the stereo pair.
|
|||||||
@param tvecs Output vector of translation vectors estimated for each pattern view, see parameter description
|
@param tvecs Output vector of translation vectors estimated for each pattern view, see parameter description
|
||||||
of previous output parameter ( rvecs ).
|
of previous output parameter ( rvecs ).
|
||||||
@param flags Different flags that may be zero or a combination of the following values:
|
@param flags Different flags that may be zero or a combination of the following values:
|
||||||
- @ref fisheye::CALIB_FIX_INTRINSIC Fix K1, K2? and D1, D2? so that only R, T matrices
|
- @ref CALIB_FIX_INTRINSIC Fix K1, K2? and D1, D2? so that only R, T matrices
|
||||||
are estimated.
|
are estimated.
|
||||||
- @ref fisheye::CALIB_USE_INTRINSIC_GUESS K1, K2 contains valid initial values of
|
- @ref CALIB_USE_INTRINSIC_GUESS K1, K2 contains valid initial values of
|
||||||
fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
|
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.
|
center (imageSize is used), and focal distances are computed in a least-squares fashion.
|
||||||
- @ref fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
|
- @ref CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
|
||||||
of intrinsic optimization.
|
of intrinsic optimization.
|
||||||
- @ref fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
|
- @ref CALIB_CHECK_COND The functions will check validity of condition number.
|
||||||
- @ref fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
|
- @ref CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
|
||||||
- @ref fisheye::CALIB_FIX_K1,..., @ref fisheye::CALIB_FIX_K4 Selected distortion coefficients are set to zeros and stay
|
- @ref CALIB_FIX_K1,..., @ref CALIB_FIX_K4 Selected distortion coefficients are set to zeros and stay
|
||||||
zero.
|
zero.
|
||||||
@param criteria Termination criteria for the iterative optimization algorithm.
|
@param criteria Termination criteria for the iterative optimization algorithm.
|
||||||
*/
|
*/
|
||||||
CV_EXPORTS_W double stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
|
CV_EXPORTS_W double stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
|
||||||
InputOutputArray K1, InputOutputArray D1, InputOutputArray K2, InputOutputArray D2, Size imageSize,
|
InputOutputArray K1, InputOutputArray D1, InputOutputArray K2, InputOutputArray D2, Size imageSize,
|
||||||
OutputArray R, OutputArray T, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags = fisheye::CALIB_FIX_INTRINSIC,
|
OutputArray R, OutputArray T, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags = CALIB_FIX_INTRINSIC,
|
||||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON));
|
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON));
|
||||||
|
|
||||||
/// @overload
|
/// @overload
|
||||||
CV_EXPORTS_W double stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
|
CV_EXPORTS_W double stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
|
||||||
InputOutputArray K1, InputOutputArray D1, InputOutputArray K2, InputOutputArray D2, Size imageSize,
|
InputOutputArray K1, InputOutputArray D1, InputOutputArray K2, InputOutputArray D2, Size imageSize,
|
||||||
OutputArray R, OutputArray T, int flags = fisheye::CALIB_FIX_INTRINSIC,
|
OutputArray R, OutputArray T, int flags = CALIB_FIX_INTRINSIC,
|
||||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON));
|
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON));
|
||||||
|
|
||||||
//! @} calib3d_fisheye
|
//! @} calib3d_fisheye
|
||||||
|
@ -427,9 +427,9 @@ TEST_F(fisheyeTest, Calibration)
|
|||||||
fs_object.release();
|
fs_object.release();
|
||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
flag |= cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC;
|
flag |= cv::CALIB_RECOMPUTE_EXTRINSIC;
|
||||||
flag |= cv::fisheye::CALIB_CHECK_COND;
|
flag |= cv::CALIB_CHECK_COND;
|
||||||
flag |= cv::fisheye::CALIB_FIX_SKEW;
|
flag |= cv::CALIB_FIX_SKEW;
|
||||||
|
|
||||||
cv::Matx33d theK;
|
cv::Matx33d theK;
|
||||||
cv::Vec4d theD;
|
cv::Vec4d theD;
|
||||||
@ -462,11 +462,11 @@ TEST_F(fisheyeTest, CalibrationWithFixedFocalLength)
|
|||||||
fs_object.release();
|
fs_object.release();
|
||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
flag |= cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC;
|
flag |= cv::CALIB_RECOMPUTE_EXTRINSIC;
|
||||||
flag |= cv::fisheye::CALIB_CHECK_COND;
|
flag |= cv::CALIB_CHECK_COND;
|
||||||
flag |= cv::fisheye::CALIB_FIX_SKEW;
|
flag |= cv::CALIB_FIX_SKEW;
|
||||||
flag |= cv::fisheye::CALIB_FIX_FOCAL_LENGTH;
|
flag |= cv::CALIB_FIX_FOCAL_LENGTH;
|
||||||
flag |= cv::fisheye::CALIB_USE_INTRINSIC_GUESS;
|
flag |= cv::CALIB_USE_INTRINSIC_GUESS;
|
||||||
|
|
||||||
cv::Matx33d theK = this->K;
|
cv::Matx33d theK = this->K;
|
||||||
const cv::Matx33d newK(
|
const cv::Matx33d newK(
|
||||||
@ -570,9 +570,9 @@ TEST_F(fisheyeTest, EstimateUncertainties)
|
|||||||
fs_object.release();
|
fs_object.release();
|
||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
flag |= cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC;
|
flag |= cv::CALIB_RECOMPUTE_EXTRINSIC;
|
||||||
flag |= cv::fisheye::CALIB_CHECK_COND;
|
flag |= cv::CALIB_CHECK_COND;
|
||||||
flag |= cv::fisheye::CALIB_FIX_SKEW;
|
flag |= cv::CALIB_FIX_SKEW;
|
||||||
|
|
||||||
cv::Matx33d theK;
|
cv::Matx33d theK;
|
||||||
cv::Vec4d theD;
|
cv::Vec4d theD;
|
||||||
@ -609,8 +609,8 @@ TEST_F(fisheyeTest, stereoRectify)
|
|||||||
{
|
{
|
||||||
// For consistency purposes
|
// For consistency purposes
|
||||||
CV_StaticAssert(
|
CV_StaticAssert(
|
||||||
static_cast<int>(cv::CALIB_ZERO_DISPARITY) == static_cast<int>(cv::fisheye::CALIB_ZERO_DISPARITY),
|
static_cast<int>(cv::CALIB_ZERO_DISPARITY) == static_cast<int>(cv::CALIB_ZERO_DISPARITY),
|
||||||
"For the purpose of continuity the following should be true: cv::CALIB_ZERO_DISPARITY == cv::fisheye::CALIB_ZERO_DISPARITY"
|
"For the purpose of continuity the following should be true: cv::CALIB_ZERO_DISPARITY == cv::CALIB_ZERO_DISPARITY"
|
||||||
);
|
);
|
||||||
|
|
||||||
const std::string folder = combine(datasets_repository_path, "calib-3_stereo_from_JY");
|
const std::string folder = combine(datasets_repository_path, "calib-3_stereo_from_JY");
|
||||||
@ -625,7 +625,7 @@ TEST_F(fisheyeTest, stereoRectify)
|
|||||||
double balance = 0.0, fov_scale = 1.1;
|
double balance = 0.0, fov_scale = 1.1;
|
||||||
cv::Mat R1, R2, P1, P2, Q;
|
cv::Mat R1, R2, P1, P2, Q;
|
||||||
cv::fisheye::stereoRectify(K1, D1, K2, D2, calibration_size, theR, theT, R1, R2, P1, P2, Q,
|
cv::fisheye::stereoRectify(K1, D1, K2, D2, calibration_size, theR, theT, R1, R2, P1, P2, Q,
|
||||||
cv::fisheye::CALIB_ZERO_DISPARITY, requested_size, balance, fov_scale);
|
cv::CALIB_ZERO_DISPARITY, requested_size, balance, fov_scale);
|
||||||
|
|
||||||
// Collected with these CMake flags: -DWITH_IPP=OFF -DCV_ENABLE_INTRINSICS=OFF -DCV_DISABLE_OPTIMIZATION=ON -DCMAKE_BUILD_TYPE=Debug
|
// Collected with these CMake flags: -DWITH_IPP=OFF -DCV_ENABLE_INTRINSICS=OFF -DCV_DISABLE_OPTIMIZATION=ON -DCMAKE_BUILD_TYPE=Debug
|
||||||
cv::Matx33d R1_ref(
|
cv::Matx33d R1_ref(
|
||||||
@ -745,9 +745,9 @@ TEST_F(fisheyeTest, stereoCalibrate)
|
|||||||
cv::Vec4d D1, D2;
|
cv::Vec4d D1, D2;
|
||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
flag |= cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC;
|
flag |= cv::CALIB_RECOMPUTE_EXTRINSIC;
|
||||||
flag |= cv::fisheye::CALIB_CHECK_COND;
|
flag |= cv::CALIB_CHECK_COND;
|
||||||
flag |= cv::fisheye::CALIB_FIX_SKEW;
|
flag |= cv::CALIB_FIX_SKEW;
|
||||||
|
|
||||||
cv::fisheye::stereoCalibrate(objectPoints, leftPoints, rightPoints,
|
cv::fisheye::stereoCalibrate(objectPoints, leftPoints, rightPoints,
|
||||||
K1, D1, K2, D2, imageSize, theR, theT, flag,
|
K1, D1, K2, D2, imageSize, theR, theT, flag,
|
||||||
@ -811,10 +811,10 @@ TEST_F(fisheyeTest, stereoCalibrateFixIntrinsic)
|
|||||||
cv::Vec3d theT;
|
cv::Vec3d theT;
|
||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
flag |= cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC;
|
flag |= cv::CALIB_RECOMPUTE_EXTRINSIC;
|
||||||
flag |= cv::fisheye::CALIB_CHECK_COND;
|
flag |= cv::CALIB_CHECK_COND;
|
||||||
flag |= cv::fisheye::CALIB_FIX_SKEW;
|
flag |= cv::CALIB_FIX_SKEW;
|
||||||
flag |= cv::fisheye::CALIB_FIX_INTRINSIC;
|
flag |= cv::CALIB_FIX_INTRINSIC;
|
||||||
|
|
||||||
cv::Matx33d K1 (561.195925927249, 0, 621.282400272412,
|
cv::Matx33d K1 (561.195925927249, 0, 621.282400272412,
|
||||||
0, 562.849402029712, 380.555455380889,
|
0, 562.849402029712, 380.555455380889,
|
||||||
@ -875,9 +875,9 @@ TEST_F(fisheyeTest, CalibrationWithDifferentPointsNumber)
|
|||||||
cv::Vec4d theD;
|
cv::Vec4d theD;
|
||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
flag |= cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC;
|
flag |= cv::CALIB_RECOMPUTE_EXTRINSIC;
|
||||||
flag |= cv::fisheye::CALIB_USE_INTRINSIC_GUESS;
|
flag |= cv::CALIB_USE_INTRINSIC_GUESS;
|
||||||
flag |= cv::fisheye::CALIB_FIX_SKEW;
|
flag |= cv::CALIB_FIX_SKEW;
|
||||||
|
|
||||||
cv::fisheye::calibrate(objectPoints, imagePoints, cv::Size(100, 100), theK, theD,
|
cv::fisheye::calibrate(objectPoints, imagePoints, cv::Size(100, 100), theK, theD,
|
||||||
cv::noArray(), cv::noArray(), flag, cv::TermCriteria(3, 20, 1e-6));
|
cv::noArray(), cv::noArray(), flag, cv::TermCriteria(3, 20, 1e-6));
|
||||||
@ -919,9 +919,9 @@ TEST_F(fisheyeTest, stereoCalibrateWithPerViewTransformations)
|
|||||||
std::vector<cv::Mat> rvecs, tvecs;
|
std::vector<cv::Mat> rvecs, tvecs;
|
||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
flag |= cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC;
|
flag |= cv::CALIB_RECOMPUTE_EXTRINSIC;
|
||||||
flag |= cv::fisheye::CALIB_CHECK_COND;
|
flag |= cv::CALIB_CHECK_COND;
|
||||||
flag |= cv::fisheye::CALIB_FIX_SKEW;
|
flag |= cv::CALIB_FIX_SKEW;
|
||||||
|
|
||||||
double rmsErrorStereoCalib = cv::fisheye::stereoCalibrate(objectPoints, leftPoints, rightPoints,
|
double rmsErrorStereoCalib = cv::fisheye::stereoCalibrate(objectPoints, leftPoints, rightPoints,
|
||||||
K1, D1, K2, D2, imageSize, theR, theT, rvecs, tvecs, flag,
|
K1, D1, K2, D2, imageSize, theR, theT, rvecs, tvecs, flag,
|
||||||
@ -1078,9 +1078,9 @@ TEST_F(fisheyeTest, multiview_calibration)
|
|||||||
std::vector<cv::Mat> Rs, Ts, Ks, distortions, rvecs0, tvecs0;
|
std::vector<cv::Mat> Rs, Ts, Ks, distortions, rvecs0, tvecs0;
|
||||||
std::vector<bool> is_fisheye(2, true);
|
std::vector<bool> is_fisheye(2, true);
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
flag |= cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC;
|
flag |= cv::CALIB_RECOMPUTE_EXTRINSIC;
|
||||||
flag |= cv::fisheye::CALIB_CHECK_COND;
|
flag |= cv::CALIB_CHECK_COND;
|
||||||
flag |= cv::fisheye::CALIB_FIX_SKEW;
|
flag |= cv::CALIB_FIX_SKEW;
|
||||||
|
|
||||||
std::vector<int> all_flags(2, flag);
|
std::vector<int> all_flags(2, flag);
|
||||||
|
|
||||||
|
@ -145,12 +145,12 @@ public:
|
|||||||
|
|
||||||
if (useFisheye) {
|
if (useFisheye) {
|
||||||
// the fisheye model has its own enum, so overwrite the flags
|
// the fisheye model has its own enum, so overwrite the flags
|
||||||
flag = fisheye::CALIB_FIX_SKEW | fisheye::CALIB_RECOMPUTE_EXTRINSIC;
|
flag = CALIB_FIX_SKEW | CALIB_RECOMPUTE_EXTRINSIC;
|
||||||
if(fixK1) flag |= fisheye::CALIB_FIX_K1;
|
if(fixK1) flag |= CALIB_FIX_K1;
|
||||||
if(fixK2) flag |= fisheye::CALIB_FIX_K2;
|
if(fixK2) flag |= CALIB_FIX_K2;
|
||||||
if(fixK3) flag |= fisheye::CALIB_FIX_K3;
|
if(fixK3) flag |= CALIB_FIX_K3;
|
||||||
if(fixK4) flag |= fisheye::CALIB_FIX_K4;
|
if(fixK4) flag |= CALIB_FIX_K4;
|
||||||
if (calibFixPrincipalPoint) flag |= fisheye::CALIB_FIX_PRINCIPAL_POINT;
|
if (calibFixPrincipalPoint) flag |= CALIB_FIX_PRINCIPAL_POINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
calibrationPattern = NOT_EXISTING;
|
calibrationPattern = NOT_EXISTING;
|
||||||
@ -728,12 +728,12 @@ static void saveCameraParams( Settings& s, Size& imageSize, Mat& cameraMatrix, M
|
|||||||
if (s.useFisheye)
|
if (s.useFisheye)
|
||||||
{
|
{
|
||||||
flagsStringStream << "flags:"
|
flagsStringStream << "flags:"
|
||||||
<< (s.flag & fisheye::CALIB_FIX_SKEW ? " +fix_skew" : "")
|
<< (s.flag & CALIB_FIX_SKEW ? " +fix_skew" : "")
|
||||||
<< (s.flag & fisheye::CALIB_FIX_K1 ? " +fix_k1" : "")
|
<< (s.flag & CALIB_FIX_K1 ? " +fix_k1" : "")
|
||||||
<< (s.flag & fisheye::CALIB_FIX_K2 ? " +fix_k2" : "")
|
<< (s.flag & CALIB_FIX_K2 ? " +fix_k2" : "")
|
||||||
<< (s.flag & fisheye::CALIB_FIX_K3 ? " +fix_k3" : "")
|
<< (s.flag & CALIB_FIX_K3 ? " +fix_k3" : "")
|
||||||
<< (s.flag & fisheye::CALIB_FIX_K4 ? " +fix_k4" : "")
|
<< (s.flag & CALIB_FIX_K4 ? " +fix_k4" : "")
|
||||||
<< (s.flag & fisheye::CALIB_RECOMPUTE_EXTRINSIC ? " +recompute_extrinsic" : "");
|
<< (s.flag & CALIB_RECOMPUTE_EXTRINSIC ? " +recompute_extrinsic" : "");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user