mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 19:50:38 +08:00
The prism distortion coefficients are added for the stereo calibration.
This commit is contained in:
parent
4fe8e377ed
commit
7fd7bbc9f1
@ -1638,12 +1638,12 @@ double cvStereoCalibrate( const CvMat* _objectPoints, const CvMat* _imagePoints1
|
|||||||
CvTermCriteria termCrit,
|
CvTermCriteria termCrit,
|
||||||
int flags )
|
int flags )
|
||||||
{
|
{
|
||||||
const int NINTRINSIC = 12;
|
const int NINTRINSIC = 16;
|
||||||
Ptr<CvMat> npoints, err, J_LR, Je, Ji, imagePoints[2], objectPoints, RT0;
|
Ptr<CvMat> npoints, err, J_LR, Je, Ji, imagePoints[2], objectPoints, RT0;
|
||||||
CvLevMarq solver;
|
CvLevMarq solver;
|
||||||
double reprojErr = 0;
|
double reprojErr = 0;
|
||||||
|
|
||||||
double A[2][9], dk[2][8]={{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0}}, rlr[9];
|
double A[2][9], dk[2][12]={{0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0}}, rlr[9];
|
||||||
CvMat K[2], Dist[2], om_LR, T_LR;
|
CvMat K[2], Dist[2], om_LR, T_LR;
|
||||||
CvMat R_LR = cvMat(3, 3, CV_64F, rlr);
|
CvMat R_LR = cvMat(3, 3, CV_64F, rlr);
|
||||||
int i, k, p, ni = 0, ofs, nimages, pointsTotal, maxPoints = 0;
|
int i, k, p, ni = 0, ofs, nimages, pointsTotal, maxPoints = 0;
|
||||||
@ -1689,7 +1689,7 @@ double cvStereoCalibrate( const CvMat* _objectPoints, const CvMat* _imagePoints1
|
|||||||
(_imagePoints1->rows == 1 && _imagePoints1->cols == pointsTotal && cn == 2)) );
|
(_imagePoints1->rows == 1 && _imagePoints1->cols == pointsTotal && cn == 2)) );
|
||||||
|
|
||||||
K[k] = cvMat(3,3,CV_64F,A[k]);
|
K[k] = cvMat(3,3,CV_64F,A[k]);
|
||||||
Dist[k] = cvMat(1,8,CV_64F,dk[k]);
|
Dist[k] = cvMat(1,12,CV_64F,dk[k]);
|
||||||
|
|
||||||
imagePoints[k].reset(cvCreateMat( points->rows, points->cols, CV_64FC(CV_MAT_CN(points->type))));
|
imagePoints[k].reset(cvCreateMat( points->rows, points->cols, CV_64FC(CV_MAT_CN(points->type))));
|
||||||
cvConvert( points, imagePoints[k] );
|
cvConvert( points, imagePoints[k] );
|
||||||
@ -1768,6 +1768,13 @@ double cvStereoCalibrate( const CvMat* _objectPoints, const CvMat* _imagePoints1
|
|||||||
imask[10] = imask[NINTRINSIC+10] = 0;
|
imask[10] = imask[NINTRINSIC+10] = 0;
|
||||||
if( flags & CV_CALIB_FIX_K6 )
|
if( flags & CV_CALIB_FIX_K6 )
|
||||||
imask[11] = imask[NINTRINSIC+11] = 0;
|
imask[11] = imask[NINTRINSIC+11] = 0;
|
||||||
|
if( flags & CV_CALIB_FIX_S1_S2_S3_S4 )
|
||||||
|
{
|
||||||
|
imask[12] = imask[NINTRINSIC+12] = 0;
|
||||||
|
imask[13] = imask[NINTRINSIC+13] = 0;
|
||||||
|
imask[14] = imask[NINTRINSIC+14] = 0;
|
||||||
|
imask[15] = imask[NINTRINSIC+15] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1842,6 +1849,10 @@ double cvStereoCalibrate( const CvMat* _objectPoints, const CvMat* _imagePoints1
|
|||||||
iparam[4] = dk[k][0]; iparam[5] = dk[k][1]; iparam[6] = dk[k][2];
|
iparam[4] = dk[k][0]; iparam[5] = dk[k][1]; iparam[6] = dk[k][2];
|
||||||
iparam[7] = dk[k][3]; iparam[8] = dk[k][4]; iparam[9] = dk[k][5];
|
iparam[7] = dk[k][3]; iparam[8] = dk[k][4]; iparam[9] = dk[k][5];
|
||||||
iparam[10] = dk[k][6]; iparam[11] = dk[k][7];
|
iparam[10] = dk[k][6]; iparam[11] = dk[k][7];
|
||||||
|
iparam[12] = dk[k][8];
|
||||||
|
iparam[13] = dk[k][9];
|
||||||
|
iparam[14] = dk[k][10];
|
||||||
|
iparam[15] = dk[k][11];
|
||||||
}
|
}
|
||||||
|
|
||||||
om_LR = cvMat(3, 1, CV_64F, solver.param->data.db);
|
om_LR = cvMat(3, 1, CV_64F, solver.param->data.db);
|
||||||
@ -1908,6 +1919,10 @@ double cvStereoCalibrate( const CvMat* _objectPoints, const CvMat* _imagePoints1
|
|||||||
dk[k][5] = iparam[k*NINTRINSIC+9];
|
dk[k][5] = iparam[k*NINTRINSIC+9];
|
||||||
dk[k][6] = iparam[k*NINTRINSIC+10];
|
dk[k][6] = iparam[k*NINTRINSIC+10];
|
||||||
dk[k][7] = iparam[k*NINTRINSIC+11];
|
dk[k][7] = iparam[k*NINTRINSIC+11];
|
||||||
|
dk[k][8] = iparam[k*NINTRINSIC+12];
|
||||||
|
dk[k][9] = iparam[k*NINTRINSIC+13];
|
||||||
|
dk[k][10] = iparam[k*NINTRINSIC+14];
|
||||||
|
dk[k][11] = iparam[k*NINTRINSIC+15];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user