gen_grid_rectification_mapT_gen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMapgen_grid_rectification_map (Operator)
gen_grid_rectification_mapT_gen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMapgen_grid_rectification_map
— Compute the mapping between the distorted image and the rectified image
based upon the points of a regular grid.
Signature
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)
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)
static void HOperatorSet.GenGridRectificationMap(HObject image, HObject connectingLines, out HObject map, out HObject meshes, HTuple gridSpacing, HTuple rotation, HTuple row, HTuple column, HTuple mapType)
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_mapgen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMapgen_grid_rectification_map
calculates the mapping between the grid
points (RowRowRowrowrow
,ColumnColumnColumncolumncolumn
), which have been actually detected in
the distorted image ImageImageImageimageimage
(typically using
saddle_points_sub_pixsaddle_points_sub_pixSaddlePointsSubPixSaddlePointsSubPixsaddle_points_sub_pix
), 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 (RowRowRowrowrow
,ColumnColumnColumncolumncolumn
) and the connecting lines
ConnectingLinesConnectingLinesConnectingLinesconnectingLinesconnecting_lines
(detected by connect_grid_pointsconnect_grid_pointsConnectGridPointsConnectGridPointsconnect_grid_points
).
In case that the
input of grid points (RowRowRowrowrow
,ColumnColumnColumncolumncolumn
) and of connecting lines
ConnectingLinesConnectingLinesConnectingLinesconnectingLinesconnecting_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 RotationRotationRotationrotationrotation
, the point grid is rotated by
0, 90, 180 or 270 degrees. Note that the
point grid does not necessarily have the correct orientation. When passing
'auto'"auto""auto""auto""auto" in RotationRotationRotationrotationrotation
, 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_gridcreate_rectification_gridCreateRectificationGridCreateRectificationGridcreate_rectification_grid
).
Finally, the mapping MapMapMapmapmap
between the distorted image and the
rectified image is calculated by interpolation between the grid points.
Each grid cell, for which the coordinates (RowRowRowrowrow
,ColumnColumnColumncolumncolumn
) of
all four corner points are known, is projected onto a square of
GridSpacingGridSpacingGridSpacinggridSpacinggrid_spacing
x GridSpacingGridSpacingGridSpacinggridSpacinggrid_spacing
pixels.
MapTypeMapTypeMapTypemapTypemap_type
is used to specify the type of the output MapMapMapmapmap
.
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:
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, in which for each pixel of the resulting image
the subpixel precise coordinates in the input image are stored.
gen_grid_rectification_mapgen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMapgen_grid_rectification_map
additionally returns the calculated meshes
as XLD contours in MeshesMeshesMeshesmeshesmeshes
.
In contrary to gen_arbitrary_distortion_mapgen_arbitrary_distortion_mapGenArbitraryDistortionMapGenArbitraryDistortionMapgen_arbitrary_distortion_map
,
gen_grid_rectification_mapgen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMapgen_grid_rectification_map
and its predecessors are used when the
coordinates (RowRowRowrowrow
,ColumnColumnColumncolumncolumn
) 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_imagewrite_imageWriteImageWriteImagewrite_image
, using the format
'tiff'"tiff""tiff""tiff""tiff".
Attention
Each input XLD contour ConnectingLinesConnectingLinesConnectingLinesconnectingLinesconnecting_lines
must own the global
attribute 'bright_dark'"bright_dark""bright_dark""bright_dark""bright_dark", as it is described with
connect_grid_pointsconnect_grid_pointsConnectGridPointsConnectGridPointsconnect_grid_points
!
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
ImageImageImageimageimage
(input_object) singlechannelimage →
objectHImageHObjectHObjectHobject (byte / uint2)
Input image.
ConnectingLinesConnectingLinesConnectingLinesconnectingLinesconnecting_lines
(input_object) xld-array →
objectHXLDHObjectHObjectHobject
Input contours.
MapMapMapmapmap
(output_object) multichannel-image →
objectHImageHObjectHObjectHobject * (int4 / uint2 / vector_field)
Image containing the mapping data.
MeshesMeshesMeshesmeshesmeshes
(output_object) xld-array →
objectHXLDHObjectHObjectHobject *
Output contours.
GridSpacingGridSpacingGridSpacinggridSpacinggrid_spacing
(input_control) integer →
HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Distance of the grid points in the rectified
image.
Restriction:
GridSpacing > 0
RotationRotationRotationrotationrotation
(input_control) string →
HTupleUnion[str, int]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)
Rotation to be applied to the point grid.
Default:
'auto'
"auto"
"auto"
"auto"
"auto"
List of values:
0, 90, 180, 270, 'auto'"auto""auto""auto""auto"
RowRowRowrowrow
(input_control) point.y-array →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Row coordinates of the grid points.
ColumnColumnColumncolumncolumn
(input_control) point.x-array →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Column coordinates of the grid points.
Restriction:
number(Column) == number(Row)
MapTypeMapTypeMapTypemapTypemap_type
(input_control) string →
HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Type of 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"
Result
gen_grid_rectification_mapgen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMapgen_grid_rectification_map
returns 2 (
H_MSG_TRUE)
if all parameter values
are correct. If necessary, an exception is raised.
Possible Predecessors
connect_grid_pointsconnect_grid_pointsConnectGridPointsConnectGridPointsconnect_grid_points
Possible Successors
map_imagemap_imageMapImageMapImagemap_image
See also
gen_arbitrary_distortion_mapgen_arbitrary_distortion_mapGenArbitraryDistortionMapGenArbitraryDistortionMapgen_arbitrary_distortion_map
Module
Calibration