gen_radial_distortion_map ( : Map : CamParIn, CamParOut, Interpolation : )

Generate a projection map that describes the mapping of images corresponding to a changing radial distortion.

gen_radial_distortion_map computes the mapping of images corresponding to a changing radial distortion in accordance to the interior camera parameters CamParIn and CamParOut which can be obtained, e.g., using the operator camera_calibration. CamParIn and CamParOut contain the old and the new camera parameters including the old and the new radial distortion, respectively (also see write_cam_par for the sequence of the parameters and the underlying camera model). Each pixel of the potential output image is transformed into the image plane using CamParOut and subsequently projected into a subpixel position of the potential input image using CamParIn.

The mapping function is stored in the output image Map. The size of Map is given by the camera parameters and therefore defines the size of the images to be mapped using map_image. If no interpolation is chosen (Interpolation = 'none'), Map consists of one image containing one channel, in which for each pixel of the output image the linearized coordinate of the pixel of the input image is stored that is the nearest neighbor to the transformed coordinates. If bilinear interpolation is chosen (Interpolation = 'bilinear'), Map consists of one image containing five channels. In the first channel for each pixel in the resulting image the linearized coordinate of the pixel in the input image is stored that is in the upper left position relative to the transformed coordinates. The four other channels contain the weights of the four neighboring pixels of the transformed coordinates which are used for the bilinear interpolation, in the following order:

+---+---+
| 2 | 3 |
+---+---+
| 4 | 5 |
+---+---+

The second channel, for example, contains the weights of the pixels that lie to the upper left relative to the transformed coordinates.

If CamParOut was computed via change_radial_distortion_cam_par, the mapping describes the effect of a lens with a modified radial distortion. If Kappa is 0 , the mapping corresponds to a rectification.

If several images have to be mapped using the same camera parameters, gen_radial_distortion_map in combination with map_image is much more efficient than the operator change_radial_distortion_image because the transformation must be computed only once.


Parameters

Map (output_object)
(multichannel-)image -> object : int4 / uint2
Image containing the mapping data.

CamParIn (input_control)
number-array -> real / integer
Old camera parameters.
Number of elements: 8

CamParOut (input_control)
number-array -> real / integer
New camera parameters.
Number of elements: 8

Interpolation (input_control)
string -> string
Type of interpolation.
Default value: 'bilinear'
List of values: 'none', 'bilinear'


Result

gen_radial_distortion_map returns 2 (H_MSG_TRUE) if all parameter values are correct. If necessary, an exception handling is raised.


Parallelization Information

gen_radial_distortion_map is reentrant and processed without parallelization.


Possible Predecessors

change_radial_distortion_cam_par, camera_calibration, hand_eye_calibration


Possible Successors

map_image


Alternatives

change_radial_distortion_image


See also

change_radial_distortion_contours_xld


Module

Calibration



Copyright © 1996-2008 MVTec Software GmbH