You can use the Camera Calibrator app to estimate camera intrinsics, extrinsics, and lens distortion parameters. You can use these camera parameters for various computer vision applications. These applications include removing the effects of lens distortion from an image, measuring planar objects, or reconstructing 3-D scenes from multiple cameras.
The suite of calibration functions used by the Camera Calibrator app provide the workflow for camera calibration. You can use these functions directly in the MATLAB® workspace. For a list of functions, see Single and Stereo Camera Calibration.
Follow this workflow to calibrate your camera using the app:
Prepare images, camera, and calibration pattern.
Add images and select standard or fisheye camera model.
Calibrate the 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. You can also make improvements using the camera calibration functions directly in the MATLAB workspace. For a list of functions, see Single and Stereo Camera Calibration.
MATLAB Toolstrip: On the Apps tab, in the Image Processing and Computer Vision section, click the Camera Calibrator icon.
MATLAB command prompt: Enter cameraCalibrator
To better the 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.
Note
The Camera Calibrator app supports only checkerboard patterns. If you are
using a different type of calibration pattern, you can still calibrate your
camera using the estimateCameraParameters
function. Using a different type of pattern requires that you supply your own
code to detect the pattern points in the image.
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 checkerboard.
Once you are satisfied with the accepted images, 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 calibrating again. If you switch between standard and fisheye camera model, you must recalibrate.
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.
To improve the calibration, you can remove high-error images, add more images, or modify the calibrator settings.
Standard Model: Change the Number of Radial Distortion Coefficients
When you are satisfied with calibration accuracy, click Export Camera Parameters. You can either save and export the camera parameters to an object by selecting Export Camera Parameters or generate the camera parameters as a MATLAB script.
[1] Zhang, Z. “A Flexible New Technique for Camera Calibration.” IEEE Transactions on Pattern Analysis and Machine Intelligence. Vol. 22, Number. 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.
[3] Scaramuzza, D., A. Martinelli, and R. Siegwart. "A Toolbox for Easy Calibrating Omindirectional Cameras." Proceedings to IEEE International Conference on Intelligent Robots and Systems (IROS 2006). Beijing, China, October 7–15, 2006.
[4] Urban, S., J. Leitloff, and S. Hinz. "Improved Wide-Angle, Fisheye and Omnidirectional Camera Calibration." ISPRS Journal of Photogrammetry and Remove Sensing. Vol. 108, 2015, pp.72–79.
Camera Calibrator | cameraParameters
| detectCheckerboardPoints
| estimateCameraParameters
| generateCheckerboardPoints
| showExtrinsics
| showReprojectionErrors
| Stereo Camera Calibrator | stereoParameters
| undistortImage