|On this page…|
You can use the camera calibrator 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 3-D reconstruction from multiple cameras.
Camera calibration using the calibrator workflow can be described in five basic steps.
Calibrate the images.
Make desired improvements, and recalibrate.
Export the parameters to an XML file.
In some cases, the default values work well, and you do not need to make any improvements before exporting parameters. The foundation suite of Camera Calibrator MATLAB functions used by the calibrator, provide the workflow for calibration and can be used directly in the MATLAB® workspace.
For best results, use between 10 and 20 images. The calibrator requires at least three images. Ideally, you should use uncompressed images, or lossless compression formats, like PNG. For greater calibration accuracy, follow the instructions outlined for preparing the pattern, setting up the camera, and capturing the images.
You can select the Camera Calibrator from the app tab on the MATLAB desktop or by typing cameraCalibrator at the MATLAB command line.
To begin calibration, load the images of the checkerboard by clicking the Add images icon. You can add images from multiple folders by clicking the Add images button for each folder. After you select the images, a prompt appears requesting the size of the checkerboard square. Enter the length of one side of a square from the checkerboard pattern.
The calibrator automatically attempts to detect a checkerboard in each of the images you selected to load. An Analyzing Images progress bar appears indicating detection progress.
If any of the images are rejected, the Detection Results window appears, which contains diagnostic information. The results indicate how many total images were processed, how many were accepted, how many were rejected, and, if any, how many duplicate images were skipped.
To view the rejected images, click the view images button. 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 or with patterns containing a greater number of squares.
A list of images with IDs appear in the Data Browser window. The images listed, are the ones that contain a detected pattern. Select the image from the list in the Data Browser to view it in the Image pane.
The Image pane displays the checkerboard image with green circles indicating detected points. You can verify the corners were detected correctly using the zoom controls on the View tab. The square indicates the (0,0) origin, and the x and y arrows indicate the checkerboard axes orientation.
Once you are satisfied with the accepted images, click the Calibrate button in the toolbar.
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. Then, try to calibrate again.
You can evaluate calibration accuracy by examining the reprojection errors and the camera extrinsics. You should also view 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.
When you are satisfied with calibration accuracy, click the Export Camera Parameters button.
The calibrator creates a cameraParameters object 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. See Measuring Planar Objects with a Calibrated Camera.
The View tab allows you to select various layouts for the calibrator user interface. It also provides zoom features. The Default Layout button is available on both the View and the Calibration tabs.
You can use these Camera Calibrator functions directly, to calculate and produce camera parameters.
 Zhang, Z. "A flexible new technique for camera calibration". IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):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.