mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 11:40:44 +08:00
Added termination criteria as a calibrateCamera() parameter
This commit is contained in:
parent
33bc089506
commit
e7b4353505
@ -111,11 +111,11 @@ calibrateCamera
|
||||
---------------
|
||||
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
|
||||
|
||||
.. ocv:function:: double calibrateCamera( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags=0 )
|
||||
.. ocv:function:: double calibrateCamera( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags=0, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON))
|
||||
|
||||
.. ocv:pyfunction:: cv2.calibrateCamera(objectPoints, imagePoints, imageSize[, cameraMatrix[, distCoeffs[, rvecs[, tvecs[, flags]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs
|
||||
.. ocv:pyfunction:: cv2.calibrateCamera(objectPoints, imagePoints, imageSize[, cameraMatrix[, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs
|
||||
|
||||
.. ocv:cfunction:: double cvCalibrateCamera2( const CvMat* objectPoints, const CvMat* imagePoints, const CvMat* pointCounts, CvSize imageSize, CvMat* cameraMatrix, CvMat* distCoeffs, CvMat* rvecs=NULL, CvMat* tvecs=NULL, int flags=0 )
|
||||
.. ocv:cfunction:: double cvCalibrateCamera2( const CvMat* objectPoints, const CvMat* imagePoints, const CvMat* pointCounts, CvSize imageSize, CvMat* cameraMatrix, CvMat* distCoeffs, CvMat* rvecs=NULL, CvMat* tvecs=NULL, int flags=0, CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON)) )
|
||||
|
||||
.. ocv:pyoldfunction:: cv.CalibrateCamera2(objectPoints, imagePoints, pointCounts, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, flags=0)-> None
|
||||
|
||||
@ -153,6 +153,8 @@ Finds the camera intrinsic and extrinsic parameters from several views of a cali
|
||||
|
||||
* **CV_CALIB_RATIONAL_MODEL** Coefficients k4, k5, and k6 are enabled. To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function use the rational model and return 8 coefficients. If the flag is not set, the function computes and returns only 5 distortion coefficients.
|
||||
|
||||
:param 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 [Zhang2000] and [BoughuetMCT]. The coordinates of 3D object points and their corresponding 2D projections
|
||||
in each view must be specified. That may be achieved by using an
|
||||
|
@ -246,7 +246,9 @@ CVAPI(double) cvCalibrateCamera2( const CvMat* object_points,
|
||||
CvMat* distortion_coeffs,
|
||||
CvMat* rotation_vectors CV_DEFAULT(NULL),
|
||||
CvMat* translation_vectors CV_DEFAULT(NULL),
|
||||
int flags CV_DEFAULT(0) );
|
||||
int flags CV_DEFAULT(0),
|
||||
CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria(
|
||||
CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON)) );
|
||||
|
||||
/* Computes various useful characteristics of the camera from the data computed by
|
||||
cvCalibrateCamera2 */
|
||||
@ -579,7 +581,8 @@ CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints,
|
||||
CV_OUT InputOutputArray cameraMatrix,
|
||||
CV_OUT InputOutputArray distCoeffs,
|
||||
OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
|
||||
int flags=0 );
|
||||
int flags=0, TermCriteria criteria = TermCriteria(
|
||||
TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) );
|
||||
|
||||
//! computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size.
|
||||
CV_EXPORTS_W void calibrationMatrixValues( InputArray cameraMatrix,
|
||||
|
@ -1452,7 +1452,7 @@ CV_IMPL void cvInitIntrinsicParams2D( const CvMat* objectPoints,
|
||||
CV_IMPL double cvCalibrateCamera2( const CvMat* objectPoints,
|
||||
const CvMat* imagePoints, const CvMat* npoints,
|
||||
CvSize imageSize, CvMat* cameraMatrix, CvMat* distCoeffs,
|
||||
CvMat* rvecs, CvMat* tvecs, int flags )
|
||||
CvMat* rvecs, CvMat* tvecs, int flags, CvTermCriteria termCrit )
|
||||
{
|
||||
const int NINTRINSIC = 12;
|
||||
Ptr<CvMat> matM, _m, _Ji, _Je, _err;
|
||||
@ -1600,7 +1600,7 @@ CV_IMPL double cvCalibrateCamera2( const CvMat* objectPoints,
|
||||
cvInitIntrinsicParams2D( matM, _m, npoints, imageSize, &matA, aspectRatio );
|
||||
}
|
||||
|
||||
solver.init( nparams, 0, cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON) );
|
||||
solver.init( nparams, 0, termCrit );
|
||||
|
||||
{
|
||||
double* param = solver.param->data.db;
|
||||
@ -3396,7 +3396,7 @@ cv::Mat cv::initCameraMatrix2D( InputArrayOfArrays objectPoints,
|
||||
double cv::calibrateCamera( InputArrayOfArrays _objectPoints,
|
||||
InputArrayOfArrays _imagePoints,
|
||||
Size imageSize, InputOutputArray _cameraMatrix, InputOutputArray _distCoeffs,
|
||||
OutputArrayOfArrays _rvecs, OutputArrayOfArrays _tvecs, int flags )
|
||||
OutputArrayOfArrays _rvecs, OutputArrayOfArrays _tvecs, int flags, TermCriteria criteria )
|
||||
{
|
||||
int rtype = CV_64F;
|
||||
Mat cameraMatrix = _cameraMatrix.getMat();
|
||||
@ -3418,7 +3418,7 @@ double cv::calibrateCamera( InputArrayOfArrays _objectPoints,
|
||||
|
||||
double reprojErr = cvCalibrateCamera2(&c_objPt, &c_imgPt, &c_npoints, imageSize,
|
||||
&c_cameraMatrix, &c_distCoeffs, &c_rvecM,
|
||||
&c_tvecM, flags );
|
||||
&c_tvecM, flags, criteria );
|
||||
|
||||
bool rvecs_needed = _rvecs.needed(), tvecs_needed = _tvecs.needed();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user