Skip to content

gen_arbitrary_distortion_mapGenArbitraryDistortionMapGenArbitraryDistortionMapgen_arbitrary_distortion_mapT_gen_arbitrary_distortion_map🔗

Short description🔗

gen_arbitrary_distortion_mapGenArbitraryDistortionMapGenArbitraryDistortionMapgen_arbitrary_distortion_mapT_gen_arbitrary_distortion_map — Generate a projection map that describes the mapping between an arbitrarily distorted image and the rectified image.

Signature🔗

gen_arbitrary_distortion_map( out image Map, integer GridSpacing, point.y Row, point.x Column, integer GridWidth, extent.x ImageWidth, extent.y ImageHeight, string MapType )void GenArbitraryDistortionMap( HObject* Map, const HTuple& GridSpacing, const HTuple& Row, const HTuple& Column, const HTuple& GridWidth, const HTuple& ImageWidth, const HTuple& ImageHeight, const HTuple& MapType )static void HOperatorSet.GenArbitraryDistortionMap( out HObject map, HTuple gridSpacing, HTuple row, HTuple column, HTuple gridWidth, HTuple imageWidth, HTuple imageHeight, HTuple mapType )def gen_arbitrary_distortion_map( grid_spacing: int, row: Sequence[float], column: Sequence[float], grid_width: int, image_width: int, image_height: int, map_type: str ) -> HObject

Herror T_gen_arbitrary_distortion_map( Hobject* Map, const Htuple GridSpacing, const Htuple Row, const Htuple Column, const Htuple GridWidth, const Htuple ImageWidth, const Htuple ImageHeight, const Htuple MapType )

static HImage HMisc::GenArbitraryDistortionMap( Hlong GridSpacing, const HTuple& Row, const HTuple& Column, Hlong GridWidth, Hlong ImageWidth, Hlong ImageHeight, const HString& MapType )

static HImage HMisc::GenArbitraryDistortionMap( Hlong GridSpacing, const HTuple& Row, const HTuple& Column, Hlong GridWidth, Hlong ImageWidth, Hlong ImageHeight, const char* MapType )

static HImage HMisc::GenArbitraryDistortionMap( Hlong GridSpacing, const HTuple& Row, const HTuple& Column, Hlong GridWidth, Hlong ImageWidth, Hlong ImageHeight, const wchar_t* MapType ) (Windows only)

static HImage HMisc.GenArbitraryDistortionMap( int gridSpacing, HTuple row, HTuple column, int gridWidth, int imageWidth, int imageHeight, string mapType )

Description🔗

gen_arbitrary_distortion_mapGenArbitraryDistortionMap computes the mapping Mapmapmap between an arbitrarily distorted image and the rectified image. The coordinates Rowrowrow and Columncolumncolumn describe a distorted grid, which will be mapped onto a regular grid in the rectified image. The coordinates of the (distorted) grid points must be passed line by line in Rowrowrow and Columncolumncolumn. GridWidthgridWidthgrid_width is the width of the point grid in grid points. GridSpacinggridSpacinggrid_spacing is the distance between two adjacent grid points in the rectified image. Because the grid points are always mapped to the centers of their corresponding pixels a grid cell requires (GridSpacing+1) x (GridSpacing+1) pixels in the rectified image. Note however, that, of course, adjacent grid cells overlap by one pixel.

To compute the mapping Mapmapmap, additionally the width ImageWidthimageWidthimage_width and height ImageHeightimageHeightimage_height of the images to be rectified must be passed.

MapTypemapTypemap_type is used to specify the type of the output Mapmapmap. If 'bilinear'"bilinear" interpolation is chosen, Mapmapmap 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" is chosen, Mapmapmap 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.

As mentioned above, four adjacent pixels in the distorted image are required to interpolate the gray value of one pixel in the mapped image. If at least one of these pixels is located outside of the distorted image the gray value can not be calculated. The domain of the resulting Mapmapmap domain is reduced accordingly.

In contrary to gen_grid_rectification_mapGenGridRectificationMap, gen_arbitrary_distortion_mapGenArbitraryDistortionMap is used when the coordinates (Rowrowrow,Columncolumncolumn) of the grid points in the distorted image are already known or the relevant part of the image consist of regular grid structures, which the coordinates can be derived from.

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_imageWriteImage, using the format 'tiff'"tiff".

Execution information🔗

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🔗

Mapmapmap (output_object) multichannel-image → object (int4 / uint2 / vector_field)HObject (int4 / uint2 / vector_field)HImage (int4 / uint2 / vector_field)HObject (int4 / uint2 / vector_field)Hobject * (int4 / uint2 / vector_field)

Image containing the mapping data.

GridSpacinggridSpacinggrid_spacing (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Distance of the grid points in the rectified image.

Restriction: GridSpacing > 0

Rowrowrow (input_control) point.y-array → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Row coordinates of the grid points in the distorted image.

Columncolumncolumn (input_control) point.x-array → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Column coordinates of the grid points in the distorted image.

Restriction: number(Row) == number(Column)

GridWidthgridWidthgrid_width (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of the point grid (number of grid points).

ImageWidthimageWidthimage_width (input_control) extent.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of the images to be rectified.

Restriction: ImageWidth > 0

ImageHeightimageHeightimage_height (input_control) extent.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of the images to be rectified.

Restriction: ImageHeight > 0

MapTypemapTypemap_type (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Type of mapping.

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

Result🔗

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

Combinations with other operators🔗

Combinations

Possible successors

map_imageMapImage

See also

create_rectification_gridCreateRectificationGrid, find_rectification_gridFindRectificationGrid, connect_grid_pointsConnectGridPoints, gen_grid_rectification_mapGenGridRectificationMap

Module🔗

Calibration