Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

stereoParameters class

Object for storing stereo camera system parameters

Syntax

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

Construction

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

stereoParams = stereoParameters(paramStruct) returns a stereoParameters object containing the parameters specified by paramStruct input. paramStruct is returned by the toStruct method.

Input Arguments

expand all

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

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

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

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

Properties

expand all

Intrinsic and extrinsic parameters of the two cameras:

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

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

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

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

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:

[P21]*FundamentalMatrix*[P11]'=0

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

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:

[P21]*EssentialMatrix*[P11]'=0

P1, the point in image 1, corresponds to P2, the point in image 2. Both points are expressed in normalized image coordinates, where the origin is at the camera's optical center. The x and y pixel coordinates are normalized by the focal length fx and fy.


Accuracy of estimated parameters:

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


Accuracy of estimated parameters:

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

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.

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

Methods

toStructConvert a stereo parameters object into a struct

Output Arguments

expand all

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

Examples

expand all

Specify calibration images.

leftImages = imageDatastore(fullfile(toolboxdir('vision'),'visiondata', ...
    'calibration','stereo','left'));
rightImages = imageDatastore(fullfile(toolboxdir('vision'),'visiondata', ...
    'calibration','stereo','right'));

Detect the checkerboards.

[imagePoints,boardSize] = ...
  detectCheckerboardPoints(leftImages.Files,rightImages.Files);

Specify the world coordinates of the checkerboard keypoints. Square size is in millimeters.

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

Calibrate the stereo camera system. Both cameras have the same resolution.

I = readimage(leftImages,1);
imageSize = [size(I,1),size(I,2)];
params = estimateCameraParameters(imagePoints,worldPoints, ...
                                  'ImageSize',imageSize);

Visualize the calibration accuracy.

  showReprojectionErrors(params);

Visualize camera extrinsics.

figure;
showExtrinsics(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.

Extended Capabilities

Introduced in R2014a

Was this topic helpful?