stereoParameters class

Object for storing stereo camera system parameters

Syntax

stereoParams = stereoParameters(cameraParameters1,cameraParameters2,rotationOfCamera2,translationOfCamera2)

Construction

stereoParams = stereoParameters(cameraParameters1,cameraParameters2,rotationOfCamera2,translationOfCamera2) returns an object that contains the parameters of a stereo camera system.

Input Arguments

expand all

cameraParameters1 — Parameters of camera 1cameraParameters object

Parameters of camera 1, specified as a cameraParameters object. You can return this object using the estimateCameraParameters function or the cameraCalibrator app. This object contains the intrinsic, extrinsic, and lens distortion parameters of camera 1.

cameraParameters2 — Parameters of camera 2cameraParameters object

Parameters of camera 2, specified as a cameraParameters object. You can return this object using the estimateCameraParameters function or the cameraCalibrator app. This object contains the intrinsic, extrinsic, and lens distortion parameters of camera 2.

rotationOfCamera2 — Rotation of camera 23-by-3 matrix

Rotation of camera 2 relative to camera 1, specified as a 3-by-3 matrix.

translationOfCamera2 — Translation of camera 23-element vector

Translation of camera 2 relative to camera 1, specified as a 3-element vector.

Properties

expand all

Intrinsic and extrinsic parameters of the two cameras:

CameraParameters1Parameters of camera 1cameraParameters object

Parameters of camera 1 , specified as a cameraParameters object. The object contains the intrinsic, extrinsic, and lens distortion parameters of a camera.

CameraParameters2Parameters of camera 2cameraParameters object

Parameters of camera 2 , specified as a cameraParameters object. The object contains the intrinsic, extrinsic, and lens distortion parameters of a camera.


Geometric relationship between the two cameras

RotationOfCamera2Rotation of camera 23-by-3 matrix

Rotation of camera 2 relative to camera 1, specified as a 3-by-3 matrix.

TranslationOfCamera2Translation of camera 23-element vector

Translation of camera 2 relative to camera 1, specified as a 3-element vector.

FundamentalMatrixFundamental matrix3-by-3 matrix

Fundamental matrix, stored as a 3-by-3 matrix. The fundamental matrix relates the two stereo cameras, such that the following equation must be true:

P1'*FundamentalMatrix*P2=0

P1, the point in image 1 in pixels, corresponds to the point, P2, in image 2.

EssentialMatrixEssential matrix3-by-3 matrix

Essential matrix, stored as a 3-by-3 matrix. The essential matrix relates the two stereo cameras, such that the following equation must be true:

P1'*EssentialMatrix*P2=0

P1, the image 1 point, corresponds to P2, the image 2 point. Both points are expressed in world units.


Accuracy of estimated parameters:

MeanReprojectionErrorAverage Euclidean distancenumber of pixels

Average Euclidean distance between reprojected points and detected points over all image pairs, specified in pixels.


Accuracy of estimated parameters:

NumPatternsNumber of calibrated patternsinteger

Number of calibration patterns that estimate the extrinsics of the two cameras, stored as an integer.

WorldPointsWorld coordinatesM-by-2 array

World coordinates of key points in the calibration pattern, specified as an M-by-2 array. M represents the number of key points in the pattern.

WorldUnitsWorld points units'mm' (default) | string

World points units, specified as a string. The string describes the units of measure.

Output Arguments

expand all

stereoParams — Stereo parameters stereoParameters object

Stereo parameters, returned as a stereoParameters object. The object contains the parameters of the stereo camera system.

Examples

expand all

Visualize Reprojection Errors for Stereo Pair of Cameras

Specify the calibration images.

    numImages = 10;
    images1  = cell(1, numImages);
    images2 = cell(1, numImages);
    for i = 1:numImages
      images1{i} = fullfile(matlabroot, 'toolbox', 'vision', ...
          'visiondemos', 'calibration', 'stereo', sprintf('left%02d.jpg', i));
      images2{i} = fullfile(matlabroot, 'toolbox', 'vision', ...
          'visiondemos', 'calibration', 'stereo', sprintf('right%02d.jpg', i));
    end

Detect the checkerboard patterns.

    [imagePoints, boardSize] = detectCheckerboardPoints(images1, images2);

Specify the world coordinates of the checkerboard keypoints.

    squareSize = 108; % millimeters
    worldPoints = generateCheckerboardPoints(boardSize, squareSize);

Calibrate the stereo camera system.

    params = estimateCameraParameters(imagePoints, worldPoints);

Visualize the calibration accuracy.

    showReprojectionErrors(params);

References

[1] Zhang, Z. "A Flexible New Technique for Camera Calibration". IEEE Transactions on Pattern Analysis and Machine Intelligence.Vol. 22, No. 11, 2000, pp. 1330–1334.

[2] Heikkila, J, and O. Silven. "A Four-step Camera Calibration Procedure with Implicit Image Correction." IEEE International Conference on Computer Vision and Pattern Recognition. 1997.

Was this topic helpful?