gen_radial_distortion_mapT_gen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMapgen_radial_distortion_map (Operator)

Name

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_mapGenRadialDistortionMapGenRadialDistortionMapGenRadialDistortionMapgen_radial_distortion_map computes the mapping of images corresponding to a changing radial distortion in accordance to the internal camera parameters CamParamInCamParamInCamParamInCamParamIncamParamIncam_param_in and CamParamOutCamParamOutCamParamOutCamParamOutcamParamOutcam_param_out which can be obtained, e.g., using the operator calibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCamerasCalibrateCamerascalibrate_cameras. CamParamInCamParamInCamParamInCamParamIncamParamIncam_param_in and CamParamOutCamParamOutCamParamOutCamParamOutcamParamOutcam_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 CamParamOutCamParamOutCamParamOutCamParamOutcamParamOutcam_param_out and subsequently projected into a subpixel position of the potential input image using CamParamInCamParamInCamParamInCamParamIncamParamIncam_param_in. Note that gen_radial_distortion_mapgen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMapGenRadialDistortionMapgen_radial_distortion_map can only be used with area scan cameras.

The mapping function is stored in the output image MapMapMapMapmapmap. The size of MapMapMapMapmapmap is given by the camera parameters CamParamOutCamParamOutCamParamOutCamParamOutcamParamOutcam_param_out and therefore defines the size of the resulting mapped images using map_imagemap_imageMapImageMapImageMapImagemap_image. The size of the images to be mapped with map_imagemap_imageMapImageMapImageMapImagemap_image is determined by the camera parameters CamParamInCamParamInCamParamInCamParamIncamParamIncam_param_in. MapTypeMapTypeMapTypeMapTypemapTypemap_type is used to specify the type of the output MapMapMapMapmapmap. If 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor" is chosen, MapMapMapMapmapmap 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""bilinear" interpolation is chosen, MapMapMapMapmapmap 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""coord_map_sub_pix" is chosen, MapMapMapMapmapmap 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 CamParamOutCamParamOutCamParamOutCamParamOutcamParamOutcam_param_out was computed via change_radial_distortion_cam_parchange_radial_distortion_cam_parChangeRadialDistortionCamParChangeRadialDistortionCamParChangeRadialDistortionCamParchange_radial_distortion_cam_par, the mapping describes the effect of a lens with a modified radial distortion. If , the mapping corresponds to a rectification.

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

Execution Information

Parameters

MapMapMapMapmapmap (output_object)  (multichannel-)image objectHImageHObjectHImageHobject * (int4 / int8 / uint2 / vector_field)

Image containing the mapping data.

CamParamInCamParamInCamParamInCamParamIncamParamIncam_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.

CamParamOutCamParamOutCamParamOutCamParamOutcamParamOutcam_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.

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

Type of the mapping.

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

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

Result

gen_radial_distortion_mapgen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMapGenRadialDistortionMapgen_radial_distortion_map returns TRUE if all parameter values are correct. If necessary, an exception is raised.

Possible Predecessors

change_radial_distortion_cam_parchange_radial_distortion_cam_parChangeRadialDistortionCamParChangeRadialDistortionCamParChangeRadialDistortionCamParchange_radial_distortion_cam_par, camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibrationcamera_calibration, hand_eye_calibrationhand_eye_calibrationHandEyeCalibrationHandEyeCalibrationHandEyeCalibrationhand_eye_calibration

Possible Successors

map_imagemap_imageMapImageMapImageMapImagemap_image

Alternatives

change_radial_distortion_imagechange_radial_distortion_imageChangeRadialDistortionImageChangeRadialDistortionImageChangeRadialDistortionImagechange_radial_distortion_image

See also

change_radial_distortion_contours_xldchange_radial_distortion_contours_xldChangeRadialDistortionContoursXldChangeRadialDistortionContoursXldChangeRadialDistortionContoursXldchange_radial_distortion_contours_xld

Module

Calibration