Main Content

Using the Stereo Camera Calibrator App

Stereo Camera Calibrator Overview

You can use the Stereo Camera Calibrator app to calibrate a stereo camera, which you can then use to recover depth from images. A stereo system consists of two cameras: camera 1 and camera 2. The app can either estimate or import the parameters of individual cameras. The app also calculates the position and orientation of camera 2, relative to camera 1.

The Stereo Camera Calibrator app can calibrate camera lenses with a field of view (FOV) of up to 95 degrees and the app produces an object that contains stereo camera parameters. You can use this object to:

The suite of calibration functions used by the Stereo Camera Calibrator app provide the workflow for stereo system calibration. You can use these functions directly in the MATLAB® workspace. For a list of calibration functions, see Camera Calibration.

Flow chart of process, prepare, add, calibrate, evaluate, adjust parameters, and export.

Follow this workflow to calibrate your stereo camera using the app:

In some cases, the default values work well, and you do not need to make any improvements before exporting parameters. You can also make improvements using the camera calibration functions directly in the MATLAB workspace. For a list of functions, see Camera Calibration.

Choose a Calibration Pattern

The Stereo Camera Calibrator app supports checkerboard, circle grid, and custom detector patterns. For details on each of these patterns, see Calibration Patterns.

Capture Calibration Images

For best calibration results, use between 10 and 20 images of the calibration pattern. The calibrator requires at least three images. Use uncompressed images or lossless compression formats such as PNG. The calibration pattern and the camera setup must satisfy a set of requirements to work with the calibrator. For more details on camera setup and capturing images, see Prepare Camera and Capture Images For Camera Calibration.

Using the Stereo Camera Calibrator App

Open the App

  • MATLAB Toolstrip: On the Apps tab, in the Image Processing and Computer Vision section, click the Stereo Camera Calibrator icon.

  • MATLAB command prompt: Enter stereoCameraCalibrator

Add Image Pairs and Select Camera Model

To begin calibration, you must add images. You can add saved images from a folder or add images directly from a camera. The calibrator analyzes the images to ensure they meet the calibrator requirements. The calibrator then detects the points on the pattern. For details on camera setup and capturing images, see Prepare Camera and Capture Images For Camera Calibration.

 Add Images from File

After you load images, the Image and Pattern Properties dialog appears. Before the calibrator can analyze the calibration patterns, you must select the calibration pattern to detect and set image properties for the pattern structure. For more details on this dialog, see Select Calibration Pattern and Set Properties.

 Analyze Images

 View Images and Detected Points



Once you are satisfied with the accepted image pairs, click the Calibrate button on the Calibration tab. The default calibration settings assume the minimum set of camera parameters. Start by running the calibration with the default settings. After evaluating the results, you can try to improve calibration accuracy by adjusting the settings and adding or removing images, and then calibrate again.


Evaluate Calibration Results

You can evaluate calibration accuracy by examining the reprojection errors, examining the camera extrinsics, or viewing the undistorted image. For best calibration results, use all three methods of evaluation.

Camera calibration results, displaying undistorted image, reprojection errors chart, and camera extrinsics diagram

 Evaluate Reprojection Errors

 Examine Extrinsic Parameter Visualization

 Show Rectified Images

Improve Calibration

To improve the calibration, you can remove high-error images, add more images, or modify the calibrator settings.

Consider adding more image pairs if:

  • You have fewer than 10 image pairs.

  • The calibration patterns do not cover enough of the image frame.

  • The calibration patterns do not have enough variation in orientation with respect to the camera.

Consider removing image pairs if the images:

  • Have a high mean reprojection error.

  • Are blurry.

  • Contain a calibration pattern at an angle greater than 45 degrees relative to the camera plane.

    Calibration pattern at angle greater than 45 degrees to the camera plane.

  • Incorrectly detected calibration pattern points.

 Change the Number of Radial Distortion Coefficients

 Compute Skew

 Compute Tangential Distortion

Export Camera Parameters

When you are satisfied with your calibration accuracy, select Export Camera Parameters. You can either save and export the camera parameters to an object in the MATLAB workspace, or generate the camera parameters as a MATLAB script.

 Export Camera Parameters

 Generate MATLAB Script


[1] Zhang, Z. “A Flexible New Technique for Camera Calibration”. IEEE Transactions on Pattern Analysis and Machine Intelligence. 22, no. 11 (November 2000): 1330–34.

[2] Heikkila, J., and O. Silven. “A Four-step Camera Calibration Procedure with Implicit Image Correction.” In Proceedings of IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 1106–12. San Juan, Puerto Rico: IEEE Comput. Soc, 1997.

See Also




Related Examples

More About