Main Content

Using the Single Camera Calibrator App

Camera Calibrator Overview

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, such as 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 Camera Calibration.

Workflow diagram; prepare images, add images, calibrate, evaluate, improve, export.

Follow this workflow to calibrate your camera using the app.

  1. Prepare the images, camera, and calibration pattern.

  2. Add the images and select standard or fisheye camera model.

  3. Calibrate the camera.

  4. Evaluate the calibration accuracy.

  5. Adjust the parameters to improve the accuracy (if necessary).

  6. Export the parameters object.

If the default values work well, then you do not need to make any adjustments before exporting the parameters.

Choose a Calibration Pattern

The 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.

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 theselected pattern. For details on camera setup and capturing images, see Prepare Camera and Capture Images.

 Add Images from File

 Acquire Live Images

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.

 Analyze Images

 View Images and Detected Points

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.

 Select Camera Model

 Standard Model Options

 Fisheye Model Options

 Calibration Algorithm

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

 Examine Reprojection Errors

 Examine Extrinsic Parameter Visualization

 View Undistorted Image

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.

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

  • Incorrectly detected calibration pattern points.

 Standard Model: Change the Number of Radial Distortion Coefficients

 Standard Model: Compute Skew

 Standard Model: Compute Tangential Distortion

 Fisheye Model: Estimate Alignment

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.

 Export Camera Parameters

 Generate 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.

[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. Bejing, 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

Objects

Related Examples

More About