ClassesClasses | | Operators

gen_radial_distortion_mapT_gen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMap (Operator)

Name

gen_radial_distortion_mapT_gen_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)

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)

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

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

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)

Description

gen_radial_distortion_mapgen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMapGenRadialDistortionMap 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_camerasCalibrateCamerasCalibrateCamerasCalibrateCameras. CamParamInCamParamInCamParamInCamParamIncamParamIn and CamParamOutCamParamOutCamParamOutCamParamOutcamParamOut contain the old and the new camera parameters including the old and the new radial distortion, respectively (also see calibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCamerasCalibrateCameras 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. Note that gen_radial_distortion_mapgen_radial_distortion_mapGenRadialDistortionMapGenRadialDistortionMapGenRadialDistortionMap 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 CamParamOutCamParamOutCamParamOutCamParamOutcamParamOut and therefore defines the size of the resulting mapped images using map_imagemap_imageMapImageMapImageMapImage. The size of the images to be mapped with map_imagemap_imageMapImageMapImageMapImage is determined by the camera parameters 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 '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 CamParamOutCamParamOutCamParamOutCamParamOutcamParamOut was computed via change_radial_distortion_cam_parchange_radial_distortion_cam_parChangeRadialDistortionCamParChangeRadialDistortionCamParChangeRadialDistortionCamPar, 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_mapGenRadialDistortionMapGenRadialDistortionMapGenRadialDistortionMap in combination with map_imagemap_imageMapImageMapImageMapImage is much more efficient than the operator change_radial_distortion_imagechange_radial_distortion_imageChangeRadialDistortionImageChangeRadialDistortionImageChangeRadialDistortionImage 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_imageWriteImageWriteImageWriteImage, using the format 'tiff'"tiff""tiff""tiff""tiff".

Execution Information

Parameters

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

Image containing the mapping data.

CamParamInCamParamInCamParamInCamParamIncamParamIn (input_control)  campar HCamPar, HTupleHTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

Old camera parameters.

CamParamOutCamParamOutCamParamOutCamParamOutcamParamOut (input_control)  campar HCamPar, HTupleHTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

New camera parameters.

MapTypeMapTypeMapTypeMapTypemapType (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Type of the mapping.

Default value: '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_mapGenRadialDistortionMapGenRadialDistortionMapGenRadialDistortionMap 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_parChangeRadialDistortionCamParChangeRadialDistortionCamParChangeRadialDistortionCamPar, camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibration, hand_eye_calibrationhand_eye_calibrationHandEyeCalibrationHandEyeCalibrationHandEyeCalibration

Possible Successors

map_imagemap_imageMapImageMapImageMapImage

Alternatives

change_radial_distortion_imagechange_radial_distortion_imageChangeRadialDistortionImageChangeRadialDistortionImageChangeRadialDistortionImage

See also

change_radial_distortion_contours_xldchange_radial_distortion_contours_xldChangeRadialDistortionContoursXldChangeRadialDistortionContoursXldChangeRadialDistortionContoursXld

Module

Calibration


ClassesClasses | | Operators