HALCON Reference Manual 10.0.2
Table of Contents / Tools / Grid Rectification ClassesClassesClasses | | | Operators

gen_grid_rectification_mapT_gen_grid_rectification_mapgen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMap (Operator)

Name

gen_grid_rectification_mapT_gen_grid_rectification_mapgen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMap — 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, ConnectingLines : Map, Meshes : GridSpacing, Rotation, Row, Col, MapType : )

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 Col, const Htuple MapType)

Herror gen_grid_rectification_map(Hobject Image, Hobject ConnectingLines, Hobject* Map, Hobject* Meshes, const HTuple& GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Col, const HTuple& MapType)

HImage HImage::GenGridRectificationMap(const HXLDArray& ConnectingLines, HXLDArray* Meshes, const HTuple& GridSpacing, const HTuple& Rotation, const HTuple& Row, const HTuple& Col, const HTuple& MapType) const

void HOperatorSetX.GenGridRectificationMap(
[in] IHUntypedObjectX* Image, [in] IHUntypedObjectX* ConnectingLines, [out] IHUntypedObjectX*Map, [out] IHUntypedObjectX*Meshes, [in] VARIANT GridSpacing, [in] VARIANT Rotation, [in] VARIANT Row, [in] VARIANT Col, [in] VARIANT MapType)

IHImageX* HImageX.GenGridRectificationMap(
[in] IHXLDX* ConnectingLines, [out] IHXLDX*Meshes, [in] Hlong GridSpacing, [in] VARIANT Rotation, [in] VARIANT Row, [in] VARIANT Col, [in] BSTR MapType)

IHImageX* HXLDX.GenGridRectificationMap(
[in] IHImageX* Image, [out] IHXLDX*Meshes, [in] Hlong GridSpacing, [in] VARIANT Rotation, [in] VARIANT Row, [in] VARIANT Col, [in] BSTR MapType)

IHImageX* HXLDContX.GenGridRectificationMap(
[in] IHImageX* Image, [out] IHXLDX*Meshes, [in] Hlong GridSpacing, [in] VARIANT Rotation, [in] VARIANT Row, [in] VARIANT Col, [in] BSTR MapType)

IHImageX* HXLDPolyX.GenGridRectificationMap(
[in] IHImageX* Image, [out] IHXLDX*Meshes, [in] Hlong GridSpacing, [in] VARIANT Rotation, [in] VARIANT Row, [in] VARIANT Col, [in] BSTR MapType)

IHImageX* HXLDParaX.GenGridRectificationMap(
[in] IHImageX* Image, [out] IHXLDX*Meshes, [in] Hlong GridSpacing, [in] VARIANT Rotation, [in] VARIANT Row, [in] VARIANT Col, [in] BSTR MapType)

IHImageX* HXLDModParaX.GenGridRectificationMap(
[in] IHImageX* Image, [out] IHXLDX*Meshes, [in] Hlong GridSpacing, [in] VARIANT Rotation, [in] VARIANT Row, [in] VARIANT Col, [in] BSTR MapType)

IHImageX* HXLDExtParaX.GenGridRectificationMap(
[in] IHImageX* Image, [out] IHXLDX*Meshes, [in] Hlong GridSpacing, [in] VARIANT Rotation, [in] VARIANT Row, [in] VARIANT Col, [in] BSTR MapType)

static void HOperatorSet.GenGridRectificationMap(HObject image, HObject connectingLines, out HObject map, out HObject meshes, HTuple gridSpacing, HTuple rotation, HTuple row, HTuple col, HTuple mapType)

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

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

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

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

Description

gen_grid_rectification_mapgen_grid_rectification_mapgen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMap calculates the mapping between the grid points (RowRowRowRowrow,ColColColColcol), which have been actually detected in the distorted image ImageImageImageImageimage (typically using saddle_points_sub_pixsaddle_points_sub_pixsaddle_points_sub_pixSaddlePointsSubPixSaddlePointsSubPix), 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,ColColColColcol) and the connecting lines ConnectingLinesConnectingLinesConnectingLinesConnectingLinesconnectingLines (detected by connect_grid_pointsconnect_grid_pointsconnect_grid_pointsConnectGridPointsConnectGridPoints). In case that the input of grid points (RowRowRowRowrow,ColColColColcol) and of connecting lines ConnectingLinesConnectingLinesConnectingLinesConnectingLinesconnectingLines 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_gridcreate_rectification_gridCreateRectificationGridCreateRectificationGrid). 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,ColColColColcol) of all four corner points are known, is projected onto a square of GridSpacingGridSpacingGridSpacingGridSpacinggridSpacing x GridSpacingGridSpacingGridSpacingGridSpacinggridSpacing pixels.

MapTypeMapTypeMapTypeMapTypemapType 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:

+---+---+
| 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 'coordinate_map_sub_pix'"coordinate_map_sub_pix""coordinate_map_sub_pix""coordinate_map_sub_pix""coordinate_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_mapgen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMap additionally returns the calculated meshes as XLD contours in MeshesMeshesMeshesMeshesmeshes.

In contrary to gen_arbitrary_distortion_mapgen_arbitrary_distortion_mapgen_arbitrary_distortion_mapGenArbitraryDistortionMapGenArbitraryDistortionMap, gen_grid_rectification_mapgen_grid_rectification_mapgen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMap and its predecessors are used when the coordinates (RowRowRowRowrow,ColColColColcol) 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_imagewrite_imageWriteImageWriteImage, using the format 'tiff'"tiff""tiff""tiff""tiff".

Attention

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

Parallelization

Parameters

ImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHImageXHobject (byte / uint2)

Input image.

ConnectingLinesConnectingLinesConnectingLinesConnectingLinesconnectingLines (input_object)  xld-array objectHXLDHXLDArrayHXLDXHobject

Input contours.

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

Image containing the mapping data.

MeshesMeshesMeshesMeshesmeshes (output_object)  xld-array objectHXLDHXLDArrayHXLDXHobject *

Output contours.

GridSpacingGridSpacingGridSpacingGridSpacinggridSpacing (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Distance of the grid points in the rectified image.

Restriction: GridSpacing > 0

RotationRotationRotationRotationrotation (input_control)  string HTupleHTupleVARIANTHtuple (string / integer) (string / int / long) (char* / Hlong) (BSTR / Hlong) (char* / Hlong)

Rotation to be applied to the point grid.

Default value: 'auto' "auto" "auto" "auto" "auto"

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

RowRowRowRowrow (input_control)  point.y-array HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Row coordinates of the grid points.

ColColColColcol (input_control)  point.x-array HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Column coordinates of the grid points.

Restriction: number(Col) == number(Row)

MapTypeMapTypeMapTypeMapTypemapType (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Type of 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"

Result

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

Possible Predecessors

connect_grid_pointsconnect_grid_pointsconnect_grid_pointsConnectGridPointsConnectGridPoints

Possible Successors

map_imagemap_imagemap_imageMapImageMapImage

See also

gen_arbitrary_distortion_mapgen_arbitrary_distortion_mapgen_arbitrary_distortion_mapGenArbitraryDistortionMapGenArbitraryDistortionMap

Module

Calibration


Table of Contents / Tools / Grid Rectification ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH