HALCON Reference Manual 10.0.2
Table of Contents / Calibration / Rectification ClassesClassesClasses | | | Operators

gen_radial_distortion_mapT_gen_radial_distortion_mapgen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMap (Operator)

Name

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

Signature

gen_radial_distortion_map( : Map : CamParamIn, CamParamOut, MapType : )

Herror T_gen_radial_distortion_map(Hobject* Map, const Htuple CamParamIn, const Htuple CamParamOut, const Htuple MapType)

Herror gen_radial_distortion_map(Hobject* Map, const HTuple& CamParamIn, const HTuple& CamParamOut, const HTuple& MapType)

HImage HImage::GenRadialDistortionMap(const HTuple& CamParamIn, const HTuple& CamParamOut, const HTuple& MapType)

void HOperatorSetX.GenRadialDistortionMap(
[out] IHUntypedObjectX*Map, [in] VARIANT CamParamIn, [in] VARIANT CamParamOut, [in] VARIANT MapType)

void HImageX.GenRadialDistortionMap(
[in] VARIANT CamParamIn, [in] VARIANT CamParamOut, [in] BSTR MapType)

static void HOperatorSet.GenRadialDistortionMap(out HObject map, HTuple camParamIn, HTuple camParamOut, HTuple mapType)

void HImage.GenRadialDistortionMap(HTuple camParamIn, HTuple camParamOut, string mapType)

Description

gen_radial_distortion_mapgen_radial_distortion_mapgen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMap computes the mapping of images corresponding to a changing radial distortion in accordance to the internal camera parameters CamParamInCamParamInCamParamInCamParamIncamParamIn and CamParamOutCamParamOutCamParamOutCamParamOutcamParamOut which can be obtained, e.g., using the operator calibrate_camerascalibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCameras. CamParamInCamParamInCamParamInCamParamIncamParamIn and CamParamOutCamParamOutCamParamOutCamParamOutcamParamOut contain the old and the new camera parameters including the old and the new radial distortion, respectively (also see write_cam_parwrite_cam_parwrite_cam_parWriteCamParWriteCamPar 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 CamParamOutCamParamOutCamParamOutCamParamOutcamParamOut and subsequently projected into a subpixel position of the potential input image using CamParamInCamParamInCamParamInCamParamIncamParamIn.

The mapping function is stored in the output image MapMapMapMapmap. The size of MapMapMapMapmap is given by the camera parameters CamParamOutCamParamOutCamParamOutCamParamOutcamParamOut and therefore defines the size of the resulting mapped images using map_imagemap_imagemap_imageMapImageMapImage. The size of the images to be mapped with map_imagemap_imagemap_imageMapImageMapImage is determined by the camera parmaters CamParamInCamParamInCamParamInCamParamIncamParamIn. MapTypeMapTypeMapTypeMapTypemapType is used to specify the type of the output MapMapMapMapmap. If 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor" is chosen, MapMapMapMapmap consists of one image containing one channel, in which for each pixel of the resulting image the linearized coordinate of the pixel of the input image is stored that is the nearest neighbor to the transformed coordinates. If 'bilinear'"bilinear""bilinear""bilinear""bilinear" interpolation is chosen, MapMapMapMapmap consists of one image containing five channels. In the first channel for each pixel in the resulting image the linearized coordinates 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 'coordinate_map_sub_pix'"coordinate_map_sub_pix""coordinate_map_sub_pix""coordinate_map_sub_pix""coordinate_map_sub_pix" is chosen, MapMapMapMapmap consists of one vector field image, in which for each pixel of the resulting image the subpixel precise coordinates in the input image are stored.

If CamParamOutCamParamOutCamParamOutCamParamOutcamParamOut was computed via change_radial_distortion_cam_parchange_radial_distortion_cam_parchange_radial_distortion_cam_parChangeRadialDistortionCamParChangeRadialDistortionCamPar, 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_mapgen_radial_distortion_mapgen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMap in combination with map_imagemap_imagemap_imageMapImageMapImage is much more efficient than the operator change_radial_distortion_imagechange_radial_distortion_imagechange_radial_distortion_imageChangeRadialDistortionImageChangeRadialDistortionImage because the transformation must be computed only once.

If you want to re-use the created map in another program, you can save it as a multi-channel image with the operator write_imagewrite_imagewrite_imageWriteImageWriteImage, using the format 'tiff'"tiff""tiff""tiff""tiff".

Parallelization

Parameters

MapMapMapMapmap (output_object)  (multichannel-)image objectHImageHImageHImageXHobject * (int4 / int8 / uint2 / vector_field)

Image containing the mapping data.

CamParamInCamParamInCamParamInCamParamIncamParamIn (input_control)  number-array HTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong)

Old camera parameters.

Number of elements: (CamParamIn == 8) || (CamParamIn == 12)

CamParamOutCamParamOutCamParamOutCamParamOutcamParamOut (input_control)  number-array HTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong)

New camera parameters.

Number of elements: (CamParamOut == 8) || (CamParamOut == 12)

MapTypeMapTypeMapTypeMapTypemapType (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Type of the mapping.

Default value: 'bilinear' "bilinear" "bilinear" "bilinear" "bilinear"

List of values: 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor", 'bilinear'"bilinear""bilinear""bilinear""bilinear", 'coord_map_sub_pix'"coord_map_sub_pix""coord_map_sub_pix""coord_map_sub_pix""coord_map_sub_pix"

Result

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

Possible Predecessors

change_radial_distortion_cam_parchange_radial_distortion_cam_parchange_radial_distortion_cam_parChangeRadialDistortionCamParChangeRadialDistortionCamPar, camera_calibrationcamera_calibrationcamera_calibrationCameraCalibrationCameraCalibration, hand_eye_calibrationhand_eye_calibrationhand_eye_calibrationHandEyeCalibrationHandEyeCalibration

Possible Successors

map_imagemap_imagemap_imageMapImageMapImage

Alternatives

change_radial_distortion_imagechange_radial_distortion_imagechange_radial_distortion_imageChangeRadialDistortionImageChangeRadialDistortionImage

See also

change_radial_distortion_contours_xldchange_radial_distortion_contours_xldchange_radial_distortion_contours_xldChangeRadialDistortionContoursXldChangeRadialDistortionContoursXld

Module

Calibration


Table of Contents / Calibration / Rectification ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH