# Calibration

Camera Calibration is a somewhat vague term that can mean different things in different contexts. This document describes geometric camera calibration, which means finding the information necessary to map pixel coordinates to coordinates in the camera's reference frame, modeling the effect of the lens. If the position of the camera with respect to the world is known, pixel coordinates can then be converted to world coordinates such as millimeters.

The VisionAppster platform comes with built-in tools to perform simple calibration without a special calibration target in addition to calibration and positioning tools that make use of a standard calibration plate. the Camera Configurator provides an easy process for an accurate calibration taking also the lens distortion in account.

## Calibration view

The Calibration view calculates the calibration factors for the selected camera. Calibration factors are intrinsic to a camera and don't change depending on its position. Thus, calibration is typically an off-line process whereas positioning can only be done once the camera has been installed. An important thing to note is that the calibration factors are fixed only if the optical configuration of the camera stays fixed. If the focal length or the focus of the lens changes, the factors will no longer apply.

The first thing to do is to select the correct value in the Camera type setting. It will select the tool used for the calibration and the other input parameters required for it. For an Area scan camera, the used input parameters and the resulting calibration factors are explained in Calibrate camera and for a Line scan camera, in Calibrate line-scan camera.

Calculating the calibration factors requires selecting at least three recorded images taken from a special calibration plate (only one image is required when calibrating only the lens distortion factors). VisionAppster calibration plates can be printed out in different paper sizes from the following links. Note that it is important to make sure that the print-out has exactly the same size in millimeters as stated in the calibration plate.

Area scan camera calibration plate:

Line scan camera calibration plate:

The calibration plates also provide values to be used as calibration input parameters, so make sure that they match with the values shown in the Calibration view.

All the recorded images for the selected camera are shown at the bottom of the view. To get the most accurate results, the images used for calibration should be recorded in a lossless format. However, the default save format for recorded images is JPG, so let's change that first. Click the recording settings () button at the bottom of the view. Then select a lossless format such as png in the Image format setting and accept the dialog. Note that each camera has its own recording settings.

To record new images, first press the record () button and then capture images using either the single shot () button or the continuous capture () button. The recorded images will appear at the bottom of the view. To select at least three images, hold down Shift or Ctrl key and click the images to be selected. The selected images are displayed also in the image display to the right. When there are multiple images selected, you can choose the one being shown in the display using the drop-down menu above the display.

To calculate the calibration factors based on the input parameter settings and the selected images, click the Calculate calibration factors button. The button will show the calculation progress in it.

If the calibration calculation is successful, the result is shown in the parameters in the Calibration factors section. The errorMeasure value shows how successful the calibration procedure was. The smaller the value, the better. A value between 0 and 1 is good, between 1 and 2 is fair and larger than 2 is poor. If the calibration fails completely, the value is infinite. In that case it is likely that the calibration plate was not detected at all in at least one image. The detectedMarkerCount value (click it to see the details) shows how many markers were detected in each image. For more detailed information of the different calibration factors, see the documentation of the used calibration tool.

In the example below, two of the selected images have been replaced with empty images. The calibration procedure fails and the detectedMarkerCount value shows zero for the empty images.

Once the calibration results are satisfactory, they can be saved as a Calibration parameter set and associated with the camera by editing the Associated parameters setting in the Calibration view.