Live Stereo Calibration

The algorithm performs intrinsic calibration, registration between the two cameras and rectification of the stereo pairs. Can run in offline and live mode

Input

Two image streams or two 2D sets of images showing a camera calibration target.

Output

Rectified image pairs

Description

Samples

When using a live mode (i.e. input are the image streams), the samples need to be captured first. A calibration targer should be visible in both images. The button Add should be used to acquire a sample. For a successul calibration it is recommended to capture around 20-30 images with the calibration target being placed in different positions and orientations with respect to the cameras.

The button Remove last can be used to remove the last captured sample pair.

The button Save can be used to save all captured samples to the disk.

Calibration

First, the used marker configuration should be specified. Refer to marker configuration for details.

Then, parameters for intrinsic camera calibration should be set. Refer to camera calibration settings for more information.

The option Normalize images indicates whether captured/input images should be normalized before starting the calibration. This might be helpful when the images are relatively dark.

The parameter Alpha is a free scaling parameter used for rectification. If it is -1, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). alpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained in the rectified images (no source image pixels are lost). Any intermediate value yields an intermediate result between those two extreme cases.

Finally, when Compute is pressed, the calibration is performed. The rectified stereo pairs with horizontal lines will be added to the data widget. If calibration is successful, when following each horizontal line from left to right image, one should observe the corresponding pixels in left and right image to be on the same height.

../../_images/LiveStereoCalibration.png

To save the calibration results, the Save button should be used. There will be two files saved:

  • cameraCalibration.xml - contains intrinsic calibration for each camera and the registration matrix between them
  • deformationMap.imf - a deformation map for the left and the right camera to perform the rectification of the images. To apply the deformation, one can use the formula:
\[r(x, y, c) = o(x+d(x, y, 0), y+d(x, y, 1), c)\]

where r is the rectified image, o is the original image, d is the deformation map, x and y are the pixel coordinates, c is the channel.

Another way to apply the deformation field is to select an image and a deformation map, and press Deformation->Attach Displacement Field.