MATLAB File Help: cv.stereoCalibrate | Index |
Calibrates the stereo camera
S = cv.stereoCalibrate(objectPoints, imagePoints1, imagePoints2, imageSize)
[...] = cv.stereoCalibrate(..., 'OptionName', optionValue, ...)
{{[x,y,z], ..}, ...}
.{{[x,y], ..}, ...}
, observed by the first camera.{{[x,y], ..}, ...}
, observed by the second camera.[w,h]
.A = [fx1 0 cx1; 0 fy1 cy1; 0 0 1]
.[k1,k2,p1,p2,k3,k4,k5,k6,s1,s2,s3,s4,taux,tauy]
of 4, 5, 8, 12
or 14 elements. The output vector length depends on the options.A = [fx2 0 cx2; 0 fy2 cy2; 0 0 1]
. The parameter is similar to
cameraMatrix1
.distCoeffs1
.cameraMatrix1
,cameraMatrix2
and distCoeffs1
,
distCoeffs2
so that only R
, T
, E
, and F
matrices are
estimated. default true.fx1
,fx2
and fy1
,fy2
. default false.fy1
,fy2
and fix the ratio fx1/fy1
,
fx2/fy2
. default false.fx1=fx2
and fy1=fy2
. default false.UseIntrinsicGuess
is set, the coefficient from the supplied DistCoeffs
matrix is used.
Otherwise, it is set to 0. default false.k4
, k5
, and k6
. 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. default false.s1
, s2
, s3
and s4
are enabled. To
provide the backward compatibility, this extra flag should be
explicitly specified to make the calibration function use the thin
prism model and return 12 coefficients. If the flag is not set, the
function computes and returns only 5 distortion coefficients.
default false.DistCoeffs
matrix is used. Otherwise,
it is set to 0. default falsetauX
and tauY
are enabled. To provide the
backward compatibility, this extra flag should be explicitly specified
to make the calibration function use the tilted sensor model and
return 14 coefficients. If the flag is not set, the function computes
and returns only 5 distortion coefficients. default false.UseIntrinsicGuess
is set, the
coefficient from the supplied DistCoeffs
matrix is used. Otherwise,
it is set to 0. default false.struct('type','Count+EPS', 'maxCount',30, 'epsilon',1e-6)
The function estimates transformation between two cameras making a stereo
pair. If you have a stereo camera where the relative position and
orientation of two cameras is fixed, and if you computed poses of an object
relative to the first camera and to the second camera, (R1,T1)
and
(R2,T2)
, respectively (this can be done with cv.solvePnP), then those
poses definitely relate to each other. This means that, given (R1,T1)
, it
should be possible to compute (R2,T2)
. You only need to know the position
and orientation of the second camera relative to the first camera. This is
what the described function does. It computes (R,T)
so that:
R2 = R * R1*T2 = R * T1 + T
Optionally, it computes the essential matrix E
:
E = [ 0 -T2 T1;
T2 0 -T0;
-T1 T0 0] * R
where Ti
are components of the translation vector T
: T = [T0,T1,T2]'
.
And the function can also compute the fundamental matrix F
:
F = inv(cameraMatrix2)' * E * inv(cameraMatrix1)
Besides the stereo-related information, the function can also perform a full calibration of each of two cameras. However, due to the high dimensionality of the parameter space and noise in the input data, the function can diverge from the correct solution. If the intrinsic parameters can be estimated with high accuracy for each of the cameras individually (for example, using cv.calibrateCamera), you are recommended to do so and then pass 'FixIntrinsic' flag to the function along with the computed intrinsic parameters. Otherwise, if all the parameters are estimated at once, it makes sense to restrict some parameters, for example, pass 'SameFocalLength' and 'ZeroTangentDist' flags, which is usually a reasonable assumption.
Similarly to cv.calibrateCamera, the function minimizes the total re-projection error for all the points in all the available views from both cameras. The function returns the final value of the re-projection error.