Loading [MathJax]/extensions/tex2jax.js

You are here: Start » Tutorial Exercises » Removing Camera Lens Distortion: Square pattern (distortions2)

Removing Camera Lens Distortion: Square pattern (distortions2)

Aim

This exercise shows how to calibrate a camera in order to remove lens distortion from an image using a non standard calibration pattern.

Input

A single input file with lens distortions. The input image contains calibration pattern made of squares. Part of the pattern is visible only partially.

The input image is stored in distortion2 directory.

Output

An image after remapping using created spatial map.

Hints

This example presents a way to calibrate a camera using a non-standard calibration pattern. This example consists of two steps. the first step is to extract points from the image. The second is to perform the calibration of the camera.

Some of image's squares are cut, so to get the best results it is necessary to select only fully visible squares.

The best way to extract squares from a background image is to use ThresholdToRegion_Dynamic filter because this algorithm is invulnerable to background changes.

To get stable positions of Region centers use RegionMassCenter.

The process of calibration of the camera needs actual image size. To get Image dimensions expand needed structure fields on an output of LoadImage filter.

Remember, that calibration has to be repeated if any of the following changes:

  1. Camera lens is replaced with other (different lens distortions).
  2. Different image resolution is selected (scale change, camera matrix is different).
  3. The camera position relative to the observed plane changes.

Solution (FIS)

►Click here to show the solution.