gen_arbitrary_distortion_mapT_gen_arbitrary_distortion_mapGenArbitraryDistortionMapGenArbitraryDistortionMapgen_arbitrary_distortion_map (算子)

名称

gen_arbitrary_distortion_mapT_gen_arbitrary_distortion_mapGenArbitraryDistortionMapGenArbitraryDistortionMapgen_arbitrary_distortion_map — 生成一个投影映射,描述任意畸变图像和校正图像之间的映射。

签名

gen_arbitrary_distortion_map( : Map : GridSpacing, Row, Column, GridWidth, ImageWidth, ImageHeight, MapType : )

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)

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 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 void HOperatorSet.GenArbitraryDistortionMap(out HObject map, HTuple gridSpacing, HTuple row, HTuple column, HTuple gridWidth, HTuple imageWidth, HTuple imageHeight, HTuple mapType)

static HImage HMisc.GenArbitraryDistortionMap(int gridSpacing, HTuple row, HTuple column, int gridWidth, int imageWidth, int imageHeight, string 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

描述

gen_arbitrary_distortion_mapgen_arbitrary_distortion_mapGenArbitraryDistortionMapGenArbitraryDistortionMapGenArbitraryDistortionMapgen_arbitrary_distortion_map computes the mapping MapMapMapMapmapmap between an arbitrarily distorted image and the rectified image. The coordinates RowRowRowRowrowrow and ColumnColumnColumnColumncolumncolumn 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 RowRowRowRowrowrow and ColumnColumnColumnColumncolumncolumn. GridWidthGridWidthGridWidthGridWidthgridWidthgrid_width is the width of the point grid in grid points. GridSpacingGridSpacingGridSpacingGridSpacinggridSpacinggrid_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 (GridSpacingGridSpacingGridSpacingGridSpacinggridSpacinggrid_spacing+1) x (GridSpacingGridSpacingGridSpacingGridSpacinggridSpacinggrid_spacing+1) pixels in the rectified image. Note however, that, of course, adjacent grid cells overlap by one pixel.

To compute the mapping MapMapMapMapmapmap, additionally the width ImageWidthImageWidthImageWidthImageWidthimageWidthimage_width and height ImageHeightImageHeightImageHeightImageHeightimageHeightimage_height of the images to be rectified must be passed.

MapTypeMapTypeMapTypeMapTypemapTypemap_type is used to specify the type of the output MapMapMapMapmapmap. If 'bilinear'"bilinear""bilinear""bilinear""bilinear""bilinear" interpolation is chosen, MapMapMapMapmapmap 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""coord_map_sub_pix" is chosen, MapMapMapMapmapmap 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 MapMapMapMapmapmap domain is reduced accordingly.

In contrary to gen_grid_rectification_mapgen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMapGenGridRectificationMapgen_grid_rectification_map, gen_arbitrary_distortion_mapgen_arbitrary_distortion_mapGenArbitraryDistortionMapGenArbitraryDistortionMapGenArbitraryDistortionMapgen_arbitrary_distortion_map is used when the coordinates (RowRowRowRowrowrow,ColumnColumnColumnColumncolumncolumn) 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_imagewrite_imageWriteImageWriteImageWriteImagewrite_image, using the format 'tiff'"tiff""tiff""tiff""tiff""tiff".

执行信息

参数

MapMapMapMapmapmap (输出对象)  multichannel-image objectHImageHObjectHImageHobject * (int4 / uint2 / vector_field)

Image containing the mapping data.

GridSpacingGridSpacingGridSpacingGridSpacinggridSpacinggrid_spacing (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Distance of the grid points in the rectified image.

限制: GridSpacing > 0

RowRowRowRowrowrow (输入控制)  point.y-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Row coordinates of the grid points in the distorted image.

ColumnColumnColumnColumncolumncolumn (输入控制)  point.x-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Column coordinates of the grid points in the distorted image.

限制: number(Row) == number(Column)

GridWidthGridWidthGridWidthGridWidthgridWidthgrid_width (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

ImageWidthImageWidthImageWidthImageWidthimageWidthimage_width (输入控制)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of the images to be rectified.

限制: ImageWidth > 0

ImageHeightImageHeightImageHeightImageHeightimageHeightimage_height (输入控制)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of the images to be rectified.

限制: ImageHeight > 0

MapTypeMapTypeMapTypeMapTypemapTypemap_type (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Type of mapping.

默认值: 'bilinear' "bilinear" "bilinear" "bilinear" "bilinear" "bilinear"

值列表: 'bilinear'"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""coord_map_sub_pix"

结果

gen_arbitrary_distortion_mapgen_arbitrary_distortion_mapGenArbitraryDistortionMapGenArbitraryDistortionMapGenArbitraryDistortionMapgen_arbitrary_distortion_map returns 2 ( H_MSG_TRUE) if all parameter values are correct。如有必要,则抛出异常。

可能的后继

map_imagemap_imageMapImageMapImageMapImagemap_image

另见

create_rectification_gridcreate_rectification_gridCreateRectificationGridCreateRectificationGridCreateRectificationGridcreate_rectification_grid, find_rectification_gridfind_rectification_gridFindRectificationGridFindRectificationGridFindRectificationGridfind_rectification_grid, connect_grid_pointsconnect_grid_pointsConnectGridPointsConnectGridPointsConnectGridPointsconnect_grid_points, gen_grid_rectification_mapgen_grid_rectification_mapGenGridRectificationMapGenGridRectificationMapGenGridRectificationMapgen_grid_rectification_map

模块

标定