mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 05:06:29 +08:00
Merge pull request #2002 from abak:stereo_calibrate
This commit is contained in:
commit
721d0145e0
@ -1261,11 +1261,11 @@ stereoCalibrate
|
||||
-------------------
|
||||
Calibrates the stereo camera.
|
||||
|
||||
.. ocv:function:: double stereoCalibrate( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1, InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2, Size imageSize, OutputArray R, OutputArray T, OutputArray E, OutputArray F, TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6), int flags=CALIB_FIX_INTRINSIC )
|
||||
.. ocv:function:: double stereoCalibrate( InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2, InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1, InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2, Size imageSize, OutputArray R, OutputArray T, OutputArray E, OutputArray F, int flags=CALIB_FIX_INTRINSIC ,TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
|
||||
|
||||
.. ocv:pyfunction:: cv2.stereoCalibrate(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize[, R[, T[, E[, F[, criteria[, flags]]]]]]) -> retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F
|
||||
.. ocv:pyfunction:: cv2.stereoCalibrate(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize[, R[, T[, E[, F[, flags[, criteria]]]]]]) -> retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F
|
||||
|
||||
.. ocv:cfunction:: double cvStereoCalibrate( const CvMat* object_points, const CvMat* image_points1, const CvMat* image_points2, const CvMat* npoints, CvMat* camera_matrix1, CvMat* dist_coeffs1, CvMat* camera_matrix2, CvMat* dist_coeffs2, CvSize image_size, CvMat* R, CvMat* T, CvMat* E=0, CvMat* F=0, CvTermCriteria term_crit=cvTermCriteria( CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,1e-6), int flags=CV_CALIB_FIX_INTRINSIC )
|
||||
.. ocv:cfunction:: double cvStereoCalibrate( const CvMat* object_points, const CvMat* image_points1, const CvMat* image_points2, const CvMat* npoints, CvMat* camera_matrix1, CvMat* dist_coeffs1, CvMat* camera_matrix2, CvMat* dist_coeffs2, CvSize image_size, CvMat* R, CvMat* T, CvMat* E=0, CvMat* F=0, int flags=CV_CALIB_FIX_INTRINSIC, CvTermCriteria term_crit=cvTermCriteria( CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,1e-6) )
|
||||
|
||||
:param objectPoints: Vector of vectors of the calibration pattern points.
|
||||
|
||||
|
@ -203,8 +203,8 @@ CV_EXPORTS_W double stereoCalibrate( InputArrayOfArrays objectPoints,
|
||||
InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1,
|
||||
InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2,
|
||||
Size imageSize, OutputArray R,OutputArray T, OutputArray E, OutputArray F,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6),
|
||||
int flags = CALIB_FIX_INTRINSIC );
|
||||
int flags = CALIB_FIX_INTRINSIC,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6) );
|
||||
|
||||
|
||||
//! computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters
|
||||
|
@ -276,9 +276,9 @@ CVAPI(double) cvStereoCalibrate( const CvMat* object_points, const CvMat* image_
|
||||
CvMat* camera_matrix2, CvMat* dist_coeffs2,
|
||||
CvSize image_size, CvMat* R, CvMat* T,
|
||||
CvMat* E CV_DEFAULT(0), CvMat* F CV_DEFAULT(0),
|
||||
int flags CV_DEFAULT(CV_CALIB_FIX_INTRINSIC),
|
||||
CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria(
|
||||
CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,1e-6)),
|
||||
int flags CV_DEFAULT(CV_CALIB_FIX_INTRINSIC));
|
||||
CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,1e-6)) );
|
||||
|
||||
#define CV_CALIB_ZERO_DISPARITY 1024
|
||||
|
||||
|
@ -1635,8 +1635,8 @@ double cvStereoCalibrate( const CvMat* _objectPoints, const CvMat* _imagePoints1
|
||||
CvMat* _cameraMatrix2, CvMat* _distCoeffs2,
|
||||
CvSize imageSize, CvMat* matR, CvMat* matT,
|
||||
CvMat* matE, CvMat* matF,
|
||||
CvTermCriteria termCrit,
|
||||
int flags )
|
||||
int flags,
|
||||
CvTermCriteria termCrit )
|
||||
{
|
||||
const int NINTRINSIC = 16;
|
||||
Ptr<CvMat> npoints, err, J_LR, Je, Ji, imagePoints[2], objectPoints, RT0;
|
||||
@ -3278,8 +3278,8 @@ double cv::stereoCalibrate( InputArrayOfArrays _objectPoints,
|
||||
InputOutputArray _cameraMatrix1, InputOutputArray _distCoeffs1,
|
||||
InputOutputArray _cameraMatrix2, InputOutputArray _distCoeffs2,
|
||||
Size imageSize, OutputArray _Rmat, OutputArray _Tmat,
|
||||
OutputArray _Emat, OutputArray _Fmat, TermCriteria criteria,
|
||||
int flags )
|
||||
OutputArray _Emat, OutputArray _Fmat, int flags ,
|
||||
TermCriteria criteria)
|
||||
{
|
||||
int rtype = CV_64F;
|
||||
Mat cameraMatrix1 = _cameraMatrix1.getMat();
|
||||
@ -3322,7 +3322,7 @@ double cv::stereoCalibrate( InputArrayOfArrays _objectPoints,
|
||||
|
||||
double err = cvStereoCalibrate(&c_objPt, &c_imgPt, &c_imgPt2, &c_npoints, &c_cameraMatrix1,
|
||||
&c_distCoeffs1, &c_cameraMatrix2, &c_distCoeffs2, imageSize,
|
||||
&c_matR, &c_matT, p_matE, p_matF, criteria, flags );
|
||||
&c_matR, &c_matT, p_matE, p_matF, flags, criteria );
|
||||
|
||||
cameraMatrix1.copyTo(_cameraMatrix1);
|
||||
cameraMatrix2.copyTo(_cameraMatrix2);
|
||||
|
@ -1733,7 +1733,7 @@ double CV_StereoCalibrationTest_C::calibrateStereoCamera( const vector<vector<Po
|
||||
|
||||
return cvStereoCalibrate(&_objPt, &_imgPt, &_imgPt2, &_npoints, &_cameraMatrix1,
|
||||
&_distCoeffs1, &_cameraMatrix2, &_distCoeffs2, imageSize,
|
||||
&matR, &matT, &matE, &matF, criteria, flags );
|
||||
&matR, &matT, &matE, &matF, flags, criteria );
|
||||
}
|
||||
|
||||
void CV_StereoCalibrationTest_C::rectify( const Mat& cameraMatrix1, const Mat& distCoeffs1,
|
||||
@ -1830,7 +1830,7 @@ double CV_StereoCalibrationTest_CPP::calibrateStereoCamera( const vector<vector<
|
||||
{
|
||||
return stereoCalibrate( objectPoints, imagePoints1, imagePoints2,
|
||||
cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2,
|
||||
imageSize, R, T, E, F, criteria, flags );
|
||||
imageSize, R, T, E, F, flags, criteria );
|
||||
}
|
||||
|
||||
void CV_StereoCalibrationTest_CPP::rectify( const Mat& cameraMatrix1, const Mat& distCoeffs1,
|
||||
|
@ -137,8 +137,8 @@ static bool run3Calibration( vector<vector<Point2f> > imagePoints1,
|
||||
double err = stereoCalibrate(objpt, imgpt, imgpt_right, cameraMatrix1, distCoeffs1,
|
||||
cameraMatrix, distCoeffs,
|
||||
imageSize, R, T, E, F,
|
||||
TermCriteria(TermCriteria::COUNT, 30, 0),
|
||||
CALIB_FIX_INTRINSIC);
|
||||
CALIB_FIX_INTRINSIC,
|
||||
TermCriteria(TermCriteria::COUNT, 30, 0));
|
||||
printf("Pair (1,%d) calibration reprojection error = %g\n", c, sqrt(err/(N*2)));
|
||||
if( c == 2 )
|
||||
{
|
||||
|
@ -172,12 +172,12 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, bool useCalibrated=
|
||||
cameraMatrix[0], distCoeffs[0],
|
||||
cameraMatrix[1], distCoeffs[1],
|
||||
imageSize, R, T, E, F,
|
||||
TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 100, 1e-5),
|
||||
CALIB_FIX_ASPECT_RATIO +
|
||||
CALIB_ZERO_TANGENT_DIST +
|
||||
CALIB_SAME_FOCAL_LENGTH +
|
||||
CALIB_RATIONAL_MODEL +
|
||||
CALIB_FIX_K3 + CALIB_FIX_K4 + CALIB_FIX_K5);
|
||||
CALIB_FIX_K3 + CALIB_FIX_K4 + CALIB_FIX_K5,
|
||||
TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 100, 1e-5) );
|
||||
cout << "done with RMS error=" << rms << endl;
|
||||
|
||||
// CALIBRATION QUALITY CHECK
|
||||
|
Loading…
Reference in New Issue
Block a user