Main Content


Convert a stereo parameters object into a struct



paramStruct = toStruct(stereoParams) returns a struct containing the stereo parameters in the stereoParams input object. You can use the struct to create an identical stereoParameters object. Use the struct for C code generation. You can call toStruct, and then pass the resulting structure into the generated code, which recreates the stereoParameters object.


collapse all

Specify calibration images.

leftImages = imageDatastore(fullfile(toolboxdir('vision'),'visiondata', ...
rightImages = imageDatastore(fullfile(toolboxdir('vision'),'visiondata', ...

Detect the checkerboards.

[imagePoints,boardSize] = ...

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, ...

Visualize the calibration accuracy.


Figure contains an axes object. The axes object with title Mean Reprojection Error per Image contains 5 objects of type bar, line. These objects represent Camera 1, Camera 2, Overall Mean Error: 0.06 pixels.

Visualize camera extrinsics.


Figure contains an axes object. The axes object with title Extrinsic Parameters Visualization contains 28 objects of type patch, text, line.

Input Arguments

collapse all

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

Output Arguments

collapse all

Stereo parameters, returned as a stereo parameters struct.

Version History

Introduced in R2015a