Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the 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.

Code Generation Support:
Supports Code Generation: Yes
Supports MATLAB Function block: No
Code Generation Support, Usage Notes, and Limitations
Use the toStruct method to pass a stereoParameters object into generated code. See the Code Generation for Depth Estimation From Stereo Video example.

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.

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

Detect the checkerboards.

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

Specify the world coordinates of the checkerboard keypoints.

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

Calibrate the stereo camera system.

im = readimage(leftImages,1);
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.

Introduced in R2014a

Was this topic helpful?