Using the Single Camera Calibrator App
Camera Calibrator Overview
You can use the Camera Calibrator app to estimate camera intrinsic parameters. You can use these camera parameters for various computer vision applications. These applications, such as removing the effects of lens distortion from an image, measuring planar objects, or reconstructing 3-D scenes from multiple cameras.
Use this workflow to calibrate your camera and to follow best practices to prepare and capture calibration images and to evaluate calibration accuracy.
The Camera Calibrator app incorporates a suite of functions to implement the camera calibration workflow. You can use these functions directly in the MATLAB® workspace. For a list of these functions, see the Camera Calibration topic.
Choose a Calibration Pattern
The Camera Calibrator app supports checkerboard, circle grid, AprilTag, ChArUco, and custom detector patterns. For details on each of these patterns and PDF files containing printable patterns, see Calibration Patterns. The app can calibrate cameras with a field of view (FOV) of up to 195 degrees.
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 Camera Calibrator App
Open the App
MATLAB Toolstrip: On the Apps tab, in the Image Processing and Computer Vision section, click the Camera Calibrator icon.
MATLAB command prompt: Enter
cameraCalibrator
Add Images 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 of the selected pattern. For details on camera setup and capturing images, see Prepare Camera and Capture Images For Camera Calibration.
After you add images, the Image and Pattern Properties dialog box to your session, 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 images, on the Calibration tab, select Calibrate. The default calibration settings use a 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 or adding or removing images, and then calibrating again. If you switch between the standard and fisheye camera models, you must recalibrate.
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 images if:
You have fewer than 10 images.
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 images 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.
Standard Model: Change the Number of Radial Distortion Coefficients
Export Camera Parameters
When you are satisfied with your calibration accuracy, select Export Camera Parameters for a standard camera model or Export Camera Parameters for a fisheye camera model. You can either export the camera parameters to an object in the MATLAB workspace or generate the camera parameters as a MATLAB script. If the default values work well, then you do not need to make any adjustments before exporting the parameters
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.
[3] Scaramuzza, Davide, Agostino Martinelli, and Roland Siegwart. "A Toolbox for Easily Calibrating Omnidirectional Cameras." In Proceedings of IEEE International Workshop on Intelligent Robots and Systems 2006 (IROS 2006), 5695–701. Beijing, China: IEEE, 2006. https://doi.org/10.1109/IROS.2006.282372
[4] Urban, Steffen, Jens Leitloff, and Stefan Hinz. “Improved Wide-Angle, Fisheye and Omnidirectional Camera Calibration.” ISPRS Journal of Photogrammetry and Remote Sensing 108 (October 2015): 72–79. https://doi.org/10.1016/j.isprsjprs.2015.06.005.
See Also
Apps
Functions
showReprojectionErrors
|showExtrinsics
|undistortImage
|detectCheckerboardPoints
|generateCheckerboardPoints
|estimateCameraParameters
|detectCharucoBoardPoints
|detectAprilGridPoints
Objects
Related Examples
- Prepare Camera and Capture Images For Camera Calibration
- Select Calibration Pattern and Set Properties
- 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