Operator Reference

gen_radial_distortion_mapT_gen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMapgen_radial_distortion_map (Operator)

gen_radial_distortion_mapT_gen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMapgen_radial_distortion_map — 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)

void GenRadialDistortionMap(HObject* Map, const HTuple& CamParamIn, const HTuple& CamParamOut, const HTuple& MapType)

void HImage::GenRadialDistortionMap(const HCamPar& CamParamIn, const HCamPar& CamParamOut, const HString& MapType)

void HImage::GenRadialDistortionMap(const HCamPar& CamParamIn, const HCamPar& CamParamOut, const char* MapType)

void HImage::GenRadialDistortionMap(const HCamPar& CamParamIn, const HCamPar& CamParamOut, const wchar_t* MapType)   ( Windows only)

HImage HCamPar::GenRadialDistortionMap(const HCamPar& CamParamOut, const HString& MapType) const

HImage HCamPar::GenRadialDistortionMap(const HCamPar& CamParamOut, const char* MapType) const

HImage HCamPar::GenRadialDistortionMap(const HCamPar& CamParamOut, const wchar_t* MapType) const   ( Windows only)

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

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

HImage HCamPar.GenRadialDistortionMap(HCamPar camParamOut, string mapType)

def gen_radial_distortion_map(cam_param_in: Sequence[Union[int, float, str]], cam_param_out: Sequence[Union[int, float, str]], map_type: str) -> HObject

Description

gen_radial_distortion_mapgen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMapgen_radial_distortion_map computes the mapping of images corresponding to a changing radial distortion in accordance to the internal camera parameters CamParamInCamParamInCamParamIncamParamIncam_param_in and CamParamOutCamParamOutCamParamOutcamParamOutcam_param_out which can be obtained, e.g., using the operator calibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCamerascalibrate_cameras. CamParamInCamParamInCamParamIncamParamIncam_param_in and CamParamOutCamParamOutCamParamOutcamParamOutcam_param_out contain the old and the new camera parameters including the old and the new radial distortion, respectively (also see Calibration 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 CamParamOutCamParamOutCamParamOutcamParamOutcam_param_out and subsequently projected into a subpixel position of the potential input image using CamParamInCamParamInCamParamIncamParamIncam_param_in. Note that gen_radial_distortion_mapgen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMapgen_radial_distortion_map can only be used with area scan cameras.

The mapping function is stored in the output image MapMapMapmapmap. The size of MapMapMapmapmap is given by the camera parameters CamParamOutCamParamOutCamParamOutcamParamOutcam_param_out and therefore defines the size of the resulting mapped images using map_imagemap_imageMapImageMapImagemap_image. The size of the images to be mapped with map_imagemap_imageMapImageMapImagemap_image is determined by the camera parameters CamParamInCamParamInCamParamIncamParamIncam_param_in. MapTypeMapTypeMapTypemapTypemap_type 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 'coord_map_sub_pix'"coord_map_sub_pix""coord_map_sub_pix""coord_map_sub_pix""coord_map_sub_pix" is chosen, MapMapMapmapmap consists of one vector field image of the semantic type 'vector_field_absolute', in which for each pixel of the resulting image the subpixel precise coordinates in the input image are stored.

If CamParamOutCamParamOutCamParamOutcamParamOutcam_param_out was computed via change_radial_distortion_cam_parchange_radial_distortion_cam_parChangeRadialDistortionCamParChangeRadialDistortionCamParchange_radial_distortion_cam_par, the mapping describes the effect of a lens with a modified radial distortion . If , the mapping corresponds to a rectification. A subsequent pose estimation (determination of the external camera parameters) is not affected by this operation.

If several images have to be mapped using the same camera parameters, gen_radial_distortion_mapgen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMapgen_radial_distortion_map in combination with map_imagemap_imageMapImageMapImagemap_image is much more efficient than the operator change_radial_distortion_imagechange_radial_distortion_imageChangeRadialDistortionImageChangeRadialDistortionImagechange_radial_distortion_image 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_imageWriteImageWriteImagewrite_image, using the format 'tiff'"tiff""tiff""tiff""tiff".

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

MapMapMapmapmap (output_object)  (multichannel-)image objectHImageHObjectHObjectHobject * (int4 / int8 / uint2 / vector_field)

Image containing the mapping data.

CamParamInCamParamInCamParamIncamParamIncam_param_in (input_control)  campar HCamPar, HTupleSequence[Union[int, float, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

Old camera parameters.

CamParamOutCamParamOutCamParamOutcamParamOutcam_param_out (input_control)  campar HCamPar, HTupleSequence[Union[int, float, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

New camera parameters.

MapTypeMapTypeMapTypemapTypemap_type (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Type of the mapping.

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

List of values: '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", 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor"

Result

gen_radial_distortion_mapgen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMapgen_radial_distortion_map 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_parChangeRadialDistortionCamParChangeRadialDistortionCamParchange_radial_distortion_cam_par, camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationcamera_calibration, hand_eye_calibrationhand_eye_calibrationHandEyeCalibrationHandEyeCalibrationhand_eye_calibration

Possible Successors

map_imagemap_imageMapImageMapImagemap_image

Alternatives

change_radial_distortion_imagechange_radial_distortion_imageChangeRadialDistortionImageChangeRadialDistortionImagechange_radial_distortion_image

See also

change_radial_distortion_contours_xldchange_radial_distortion_contours_xldChangeRadialDistortionContoursXldChangeRadialDistortionContoursXldchange_radial_distortion_contours_xld

Module

Calibration