cv.stereoCalibrate - MATLAB File Help
cv.stereoCalibrate

Calibrates the stereo camera

S = cv.stereoCalibrate(objectPoints, imagePoints1, imagePoints2, imageSize)
[...] = cv.stereoCalibrate(..., 'OptionName', optionValue, ...)

Input

Output

Options

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.

See also