Documentation Center

  • Trials
  • Product Updates

Find Camera Parameters with the Camera Calibrator

Camera Calibrator Overview

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.

Calibration Workflow

Camera calibration using the calibrator workflow can be described in five basic steps.

  1. Load images.

  2. Calibrate the images.

  3. Evaluate results.

  4. Make desired improvements, and recalibrate.

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

Image, Camera, and Pattern Preparation

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.

 Checkerboard Pattern

 Camera Setup

 Capture Images

Open the Camera Calibrator

You can select the Camera Calibrator from the app tab on the MATLAB desktop or by typing cameraCalibrator at the MATLAB command line.

Load Images

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.

Detected Points

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.

Calibrate

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.

 Calibration Algorithm

Evaluate Calibration Results

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.

 Reprojection Errors

 Extrinsic Parameter Visualization

 Show Undistorted Image

Improve Calibration

To improve the calibration, you can remove high-error images, add more images, or modify the calibrator settings.

 Add and Delete Images

 Change the Number of Radial Distortion Coefficients

 Compute Skew

 Compute Tangential Distortion

Export Camera Parameters

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.

File Management

 New Session

 Open Session

 Save Session

 Add Images

Views and Layout

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.

Camera Calibrator MATLAB functions

You can use these Camera Calibrator functions directly, to calculate and produce camera parameters.

References

[1] Zhang, Z. "A flexible new technique for camera calibration". IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11):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.

See Also

| | | | | | | |

Related Examples

External Web Sites

Was this topic helpful?