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:
Rectify stereo images using the
rectifyStereoImages
function.Reconstruct a 3-D scene using the
reconstructScene
function.Compute 3-D locations corresponding to matching pairs of image points using the
triangulate
function.
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.
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, AprilTag, ChArUco, 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.
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.
Calibrate
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.
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.
Incorrectly detected calibration pattern points.
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.
References
[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. https://doi.org/10.1109/34.888718.
[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. https://doi.org/10.1109/CVPR.1997.609468.
See Also
Apps
Functions
showReprojectionErrors
|showExtrinsics
|undistortImage
|detectCheckerboardPoints
|generateCheckerboardPoints
|estimateCameraParameters
|detectCharucoBoardPoints
|detectAprilGridPoints
|generateArucoMarker
Objects
Related Examples
- Evaluating the Accuracy of Single Camera Calibration
- Measuring Planar Objects with a Calibrated Camera
- Camera Calibration Using Custom Planar Calibration Patterns
- Structure from Motion from Two Views
- Structure from Motion from Multiple Views
- Depth Estimation from Stereo Video
- 3-D Point Cloud Registration and Stitching
- Uncalibrated Stereo Image Rectification