Skip to content

gen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMapgen_grid_rectification_mapT_gen_grid_rectification_mapπŸ”—

Short descriptionπŸ”—

gen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMapgen_grid_rectification_mapT_gen_grid_rectification_map β€” Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.

SignatureπŸ”—

gen_grid_rectification_map( image Image, xld ConnectingLines, out image Map, out xld Meshes, integer GridSpacing, string Rotation, point.y Row, point.x Column, string MapType )void GenGridRectificationMap( const HObject& Image, const HObject& ConnectingLines, HObject* Map, HObject* Meshes, const HTuple& GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Column, const HTuple& MapType )static void HOperatorSet.GenGridRectificationMap( HObject image, HObject connectingLines, out HObject map, out HObject meshes, HTuple gridSpacing, HTuple rotation, HTuple row, HTuple column, HTuple mapType )def gen_grid_rectification_map( image: HObject, connecting_lines: HObject, grid_spacing: int, rotation: Union[str, int], row: Sequence[float], column: Sequence[float], map_type: str ) -> Tuple[HObject, HObject]

Herror T_gen_grid_rectification_map( const Hobject Image, const Hobject ConnectingLines, Hobject* Map, Hobject* Meshes, const Htuple GridSpacing, const Htuple Rotation, const Htuple Row, const Htuple Column, const Htuple MapType )

HImage HImage::GenGridRectificationMap( const HXLD& ConnectingLines, HXLD* Meshes, Hlong GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HImage::GenGridRectificationMap( const HXLD& ConnectingLines, HXLD* Meshes, Hlong GridSpacing, const HString& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HImage::GenGridRectificationMap( const HXLD& ConnectingLines, HXLD* Meshes, Hlong GridSpacing, const char* Rotation, const HTuple& Row, const HTuple& Column, const char* MapType ) const

HImage HImage::GenGridRectificationMap( const HXLD& ConnectingLines, HXLD* Meshes, Hlong GridSpacing, const wchar_t* Rotation, const HTuple& Row, const HTuple& Column, const wchar_t* MapType ) const (Windows only)

HImage HXLD::GenGridRectificationMap( const HImage& Image, HXLD* Meshes, Hlong GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLD::GenGridRectificationMap( const HImage& Image, HXLD* Meshes, Hlong GridSpacing, const HString& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLD::GenGridRectificationMap( const HImage& Image, HXLD* Meshes, Hlong GridSpacing, const char* Rotation, const HTuple& Row, const HTuple& Column, const char* MapType ) const

HImage HXLD::GenGridRectificationMap( const HImage& Image, HXLD* Meshes, Hlong GridSpacing, const wchar_t* Rotation, const HTuple& Row, const HTuple& Column, const wchar_t* MapType ) const (Windows only)

HImage HXLDCont::GenGridRectificationMap( const HImage& Image, HXLDCont* Meshes, Hlong GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLDCont::GenGridRectificationMap( const HImage& Image, HXLDCont* Meshes, Hlong GridSpacing, const HString& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLDCont::GenGridRectificationMap( const HImage& Image, HXLDCont* Meshes, Hlong GridSpacing, const char* Rotation, const HTuple& Row, const HTuple& Column, const char* MapType ) const

HImage HXLDCont::GenGridRectificationMap( const HImage& Image, HXLDCont* Meshes, Hlong GridSpacing, const wchar_t* Rotation, const HTuple& Row, const HTuple& Column, const wchar_t* MapType ) const (Windows only)

HImage HXLDPoly::GenGridRectificationMap( const HImage& Image, HXLDPoly* Meshes, Hlong GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLDPoly::GenGridRectificationMap( const HImage& Image, HXLDPoly* Meshes, Hlong GridSpacing, const HString& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLDPoly::GenGridRectificationMap( const HImage& Image, HXLDPoly* Meshes, Hlong GridSpacing, const char* Rotation, const HTuple& Row, const HTuple& Column, const char* MapType ) const

HImage HXLDPoly::GenGridRectificationMap( const HImage& Image, HXLDPoly* Meshes, Hlong GridSpacing, const wchar_t* Rotation, const HTuple& Row, const HTuple& Column, const wchar_t* MapType ) const (Windows only)

HImage HXLDPara::GenGridRectificationMap( const HImage& Image, HXLDPara* Meshes, Hlong GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLDPara::GenGridRectificationMap( const HImage& Image, HXLDPara* Meshes, Hlong GridSpacing, const HString& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLDPara::GenGridRectificationMap( const HImage& Image, HXLDPara* Meshes, Hlong GridSpacing, const char* Rotation, const HTuple& Row, const HTuple& Column, const char* MapType ) const

HImage HXLDPara::GenGridRectificationMap( const HImage& Image, HXLDPara* Meshes, Hlong GridSpacing, const wchar_t* Rotation, const HTuple& Row, const HTuple& Column, const wchar_t* MapType ) const (Windows only)

HImage HXLDModPara::GenGridRectificationMap( const HImage& Image, HXLDModPara* Meshes, Hlong GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLDModPara::GenGridRectificationMap( const HImage& Image, HXLDModPara* Meshes, Hlong GridSpacing, const HString& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLDModPara::GenGridRectificationMap( const HImage& Image, HXLDModPara* Meshes, Hlong GridSpacing, const char* Rotation, const HTuple& Row, const HTuple& Column, const char* MapType ) const

HImage HXLDModPara::GenGridRectificationMap( const HImage& Image, HXLDModPara* Meshes, Hlong GridSpacing, const wchar_t* Rotation, const HTuple& Row, const HTuple& Column, const wchar_t* MapType ) const (Windows only)

HImage HXLDExtPara::GenGridRectificationMap( const HImage& Image, HXLDExtPara* Meshes, Hlong GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLDExtPara::GenGridRectificationMap( const HImage& Image, HXLDExtPara* Meshes, Hlong GridSpacing, const HString& Rotation, const HTuple& Row, const HTuple& Column, const HString& MapType ) const

HImage HXLDExtPara::GenGridRectificationMap( const HImage& Image, HXLDExtPara* Meshes, Hlong GridSpacing, const char* Rotation, const HTuple& Row, const HTuple& Column, const char* MapType ) const

HImage HXLDExtPara::GenGridRectificationMap( const HImage& Image, HXLDExtPara* Meshes, Hlong GridSpacing, const wchar_t* Rotation, const HTuple& Row, const HTuple& Column, const wchar_t* MapType ) const (Windows only)

HImage HImage.GenGridRectificationMap( HXLD connectingLines, out HXLD meshes, int gridSpacing, HTuple rotation, HTuple row, HTuple column, string mapType )

HImage HImage.GenGridRectificationMap( HXLD connectingLines, out HXLD meshes, int gridSpacing, string rotation, HTuple row, HTuple column, string mapType )

HImage HXLD.GenGridRectificationMap( HImage image, out HXLD meshes, int gridSpacing, HTuple rotation, HTuple row, HTuple column, string mapType )

HImage HXLD.GenGridRectificationMap( HImage image, out HXLD meshes, int gridSpacing, string rotation, HTuple row, HTuple column, string mapType )

HImage HXLDCont.GenGridRectificationMap( HImage image, out HXLDCont meshes, int gridSpacing, HTuple rotation, HTuple row, HTuple column, string mapType )

HImage HXLDCont.GenGridRectificationMap( HImage image, out HXLDCont meshes, int gridSpacing, string rotation, HTuple row, HTuple column, string mapType )

HImage HXLDPoly.GenGridRectificationMap( HImage image, out HXLDPoly meshes, int gridSpacing, HTuple rotation, HTuple row, HTuple column, string mapType )

HImage HXLDPoly.GenGridRectificationMap( HImage image, out HXLDPoly meshes, int gridSpacing, string rotation, HTuple row, HTuple column, string mapType )

HImage HXLDPara.GenGridRectificationMap( HImage image, out HXLDPara meshes, int gridSpacing, HTuple rotation, HTuple row, HTuple column, string mapType )

HImage HXLDPara.GenGridRectificationMap( HImage image, out HXLDPara meshes, int gridSpacing, string rotation, HTuple row, HTuple column, string mapType )

HImage HXLDModPara.GenGridRectificationMap( HImage image, out HXLDModPara meshes, int gridSpacing, HTuple rotation, HTuple row, HTuple column, string mapType )

HImage HXLDModPara.GenGridRectificationMap( HImage image, out HXLDModPara meshes, int gridSpacing, string rotation, HTuple row, HTuple column, string mapType )

HImage HXLDExtPara.GenGridRectificationMap( HImage image, out HXLDExtPara meshes, int gridSpacing, HTuple rotation, HTuple row, HTuple column, string mapType )

HImage HXLDExtPara.GenGridRectificationMap( HImage image, out HXLDExtPara meshes, int gridSpacing, string rotation, HTuple row, HTuple column, string mapType )

DescriptionπŸ”—

gen_grid_rectification_mapGenGridRectificationMap calculates the mapping between the grid points (Rowrowrow,Columncolumncolumn), which have been actually detected in the distorted image Imageimageimage (typically using saddle_points_sub_pixSaddlePointsSubPix), and the corresponding grid points of the ideal regular point grid. First, all paths that lead from their initial point via exactly four different connecting lines back to the initial point are assembled from the grid points (Rowrowrow,Columncolumncolumn) and the connecting lines ConnectingLinesconnectingLinesconnecting_lines (detected by connect_grid_pointsConnectGridPoints). In case that the input of grid points (Rowrowrow,Columncolumncolumn) and of connecting lines ConnectingLinesconnectingLinesconnecting_lines was meaningful, one such β€˜mesh’ corresponds to exactly one grid cell in the rectification grid. Afterwards, the meshes are combined to the point grid. According to the value of Rotationrotationrotation, the point grid is rotated by 00, 9090, 180180 or 270270 degrees. Note that the point grid does not necessarily have the correct orientation. When passing 'auto'"auto" in Rotationrotationrotation, the point grid is rotated such that the black circular mark in the rectification grid is positioned to the left of the white one (see also create_rectification_gridCreateRectificationGrid). Finally, the mapping Mapmapmap between the distorted image and the rectified image is calculated by interpolation between the grid points. Each grid cell, for which the coordinates (Rowrowrow,Columncolumncolumn) of all four corner points are known, is projected onto a square of GridSpacingΒ x GridSpacing pixels.

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.

gen_grid_rectification_mapGenGridRectificationMap additionally returns the calculated meshes as XLD contours in Meshesmeshesmeshes.

In contrary to gen_arbitrary_distortion_mapGenArbitraryDistortionMap, gen_grid_rectification_mapGenGridRectificationMap and its predecessors are used when the coordinates (Rowrowrow,Columncolumncolumn) of the grid points in the distorted image are neither known nor can be derived from the image contents.

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

AttentionπŸ”—

Each input XLD contour ConnectingLinesconnectingLinesconnecting_lines must own the global attribute 'bright_dark'"bright_dark", as it is described with connect_grid_pointsConnectGridPoints!

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πŸ”—

Imageimageimage (input_object) singlechannelimage β†’ object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

Input image.

ConnectingLinesconnectingLinesconnecting_lines (input_object) xld-array β†’ objectHObjectHXLDHObjectHobject

Input contours.

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.

Meshesmeshesmeshes (output_object) xld-array β†’ objectHObjectHXLDHObjectHobject *

Output contours.

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

Rotationrotationrotation (input_control) string β†’ (string / integer)HTuple (HString / Hlong)HTuple (string / int / long)Union[str, int]Htuple (char* / Hlong)

Rotation to be applied to the point grid.

Default: 'auto'"auto"
List of values: 0, 90, 180, 270, 'auto'0, 90, 180, 270, "auto"

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

Row coordinates of the grid points.

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

Column coordinates of the grid points.

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

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_grid_rectification_mapGenGridRectificationMap returns 2 (H_MSG_TRUE) if all parameter values are correct. If necessary, an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

connect_grid_pointsConnectGridPoints

Possible successors

map_imageMapImage

See also

gen_arbitrary_distortion_mapGenArbitraryDistortionMap

ModuleπŸ”—

Calibration