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 estimates the parameters of each of the two cameras. It also calculates the position and orientation of camera 2 relative to camera 1.
The app produces an object containing the stereo camera parameters.
You can use this object to rectify stereo images using the
rectifyStereoImages function, reconstruct
the 3-D scene using the
or compute 3-D locations corresponding to matching
pairs of image points using the
The suite of calibration functions used by the Stereo Camera Calibrator app provide the workflow for stereo system calibration. You can use them directly in the MATLAB® workspace. For a list of functions, see Single Camera Calibration.
You can use the Camera Calibrator app with cameras up to a field of view (FOV) of 95 degrees.
Follow this workflow to calibrate your stereo camera using the app:
Prepare images, camera, and calibration pattern.
Load image pairs.
Calibrate the stereo camera.
Evaluate calibration accuracy.
Adjust parameters to improve accuracy (if necessary).
Export the parameters object.
In some cases, the default values work well, and you do not need to make any improvements before exporting parameters. If you do need to make improvements, you can use the camera calibration functions in MATLAB. For a list of functions, see Single Camera Calibration.
MATLAB Toolstrip: Open the Apps tab, under Image Processing and Computer Vision, click the app icon.
MATLAB command prompt: Enter
For best 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 greater calibration accuracy, follow these instructions for preparing the pattern, setting up the camera, and capturing the images.
To begin calibration, click Add images to add two sets of stereo images of the checkerboard. You can add images from multiple folders by clicking Add images. Select the locations for the images corresponding to camera 1 and camera 2. Enter the length of one side of a square from the checkerboard pattern.
The calibrator attempts to detect a checkerboard in each of the added images. An Analyzing Images progress bar window appears, indicating detection progress.
If any of the image pairs are rejected, the Detection Results window appears, which contains diagnostic information. The results indicate how many total image pairs were processed, and how many were accepted, rejected, or skipped The calibrator skips duplicate images.
To view the rejected images, click view images. The calibrator rejects duplicate images. It also rejects images where the entire checkerboard could not be detected. Possible reasons for no detection are a blurry image or an extreme angle of the pattern. Detection takes longer with larger images and with patterns that contain a large number of squares.
The Data Browser pane displays a list of image pairs with IDs. These image pairs contain a detected pattern. To view an image, select it from the Data Browser pane.
The Image pane displays the checkerboard image pair with green circles to indicate detected points. You can verify the corners were detected correctly using the zoom controls. The yellow square indicates the (0,0) origin. The X and Y arrows indicate the checkerboard axes orientation.
Once you are satisfied with the accepted image pairs, click Calibrate. 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.
You can evaluate calibration accuracy by examining the reprojection errors and the camera extrinsics, and by viewing the undistorted image. For best calibration results, use all three methods of evaluation.
To improve the calibration, you can remove high-error image pairs, add more image pairs, or modify the calibrator settings.
When you are satisfied with calibration accuracy, click Export Camera Parameters. You can save and export the camera parameters to an object or generate the camera parameters as a MATLAB script.
Click Export Camera Parameters to create
in your workspace. The object contains the intrinsic and extrinsic
parameters of the camera, and the distortion coefficients. You can
use this object for various computer vision tasks, such as image undistortion,
measuring planar objects, and 3-D reconstruction. You can optionally
which contains the standard errors of estimated stereo parameters.
You can also generate a MATLAB script which allows you save and reproduce the steps from your calibration session.
 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.
 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.
Calibrator | Stereo
Camera Calibrator |