| Customize Help
| Save Settings

MgenWarpParameter



Function Map
Synopsis
Generate coefficients or LUTs used to warp an image.
Syntax
void MgenWarpParameter(
MIL_ID SrcArrayBufId, //in
MIL_ID DstXLutOrArrayBufId, //in
MIL_ID DstYLutBufId, //in
MIL_INT OperationMode, //in
MIL_INT Transform, //in
MIL_DOUBLE Val1, //in
MIL_DOUBLE Val2 //in
)
Description

This function generates coefficients or LUTs to be used by MimWarp() to perform first-order polynomial warpings or perspective polynomial warpings. Specifically, this function can generate:

  • Coefficients for a first-order polynomial warping (M_WARP_POLYNOMIAL).

  • Coefficients or LUTs for a perspective polynomial warping that maps an arbitrary quadrilateral onto a rectangle (M_WARP_4_CORNER) or that maps a rectangle onto an arbitrary quadrilateral (M_WARP_4_CORNER_REVERSE).

  • LUTs, based on the input of a matrix of coefficients, for a first-order polynomial warping or for a perspective polynomial warping (M_WARP_LUT).

Note that when generating LUTs for a M_WARP_4_CORNER or a M_WARP_4_CORNER_REVERSE perspective polynomial warping, the coefficients that were internally generated and used cannot be retrieved. To generate LUTs while saving the coefficients, you must call MgenWarpParameter() twice: once to generate the coefficients needed to produce the LUTs, and the second time to actually generate the LUTs with M_WARP_LUT.

For a first-order polynomial warping, this function can generate coefficients or LUTs for a rotation, a scaling, a shearing, or a translation. To combine coefficients (for example, to generate coefficients that will perform both a rotation and a translation), you need to make separate calls to this function, using the previous output buffer of type M_ARRAY as your current input buffer. If required, after the appropriate coefficients are generated, you can pass the coefficient buffer to MgenWarpParameter() with M_WARP_LUT to generate the corresponding LUTs.

Coefficients are calculated such that each pixel position of the destination buffer, (x d,y d) is associated with a specific point in the source buffer, (x s,y s), according to the following equation:

Where xs and ys are defined as follows:

Note that in the case of a first-order polynomial warping, the c0, c1, c2 coefficients are 0, 0, and 1, respectively. The equation then reduces to:

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
SrcArrayBufId

Specifies the input buffer from which to generate coefficients or LUT entries. If an input buffer is not required to perform the coefficient generation, set this parameter to M_NULL.

See the Parameter associations section for possible values that can be specified.

DstXLutOrArrayBufId

Specifies the buffer in which to place generated coefficients or X-LUT entries.

See the Parameter associations section for possible values that can be specified.

DstYLutBufId

Specifies the buffer in which to place Y-LUT entries. If you are not generating LUTs, set this parameter to M_NULL.

See the Parameter associations section for possible values that can be specified.

OperationMode

Specifies the mode of operation.

See the Parameter associations section for possible values that can be specified.

Transform

Specifies the type of first-order polynomial warping for which to generate coefficients. If you are not generating coefficients for a first-order polynomial warping (M_WARP_POLYNOMIAL), set the this parameter to M_DEFAULT.

function map For specifying the type of first-order polynomial warping
Click to summarizeValue Description
Click to summarize M_ROTATE

Generates coefficients for a counter-clockwise rotation around (0,0) by Val1 °.

Click to summarize M_SCALE

Generates coefficients for an image scaling, by a factor of Val1 in the X-direction and by a factor of Val2 in the Y-direction.

Click to summarize M_SHEAR_X

Generates coefficients or for a shearing in the X-direction, by a factor of Val1.

Click to summarize M_SHEAR_Y

Generates coefficients for a shearing in the Y-direction, by a factor of Val1.

Click to summarize M_TRANSLATE

Generates coefficients for a translation by Val1 pixels in the X-direction and by Val2 pixels in the Y-direction.

Val1

Specifies the first transform constant. If this parameter is not being used, set it to M_NULL.

Val2

Specifies the second transform constant. If this parameter is not being used, set it to M_NULL.

The table below lists possible values for the SrcArrayBufId, DstXLutOrArrayBufId, DstYLutBufId, and OperationMode parameters.

function map For selecting the operation mode
Click to summarizeOperationMode Description
SrcArrayBufId
DstXLutOrArrayBufId
DstYLutBufId
Click to summarize M_WARP_4_CORNER +

Generates coefficients or LUT values for a perspective polynomial warping which, when passed to MimWarp(), maps an arbitrary quadrilateral onto a rectangle.

(summarize)
Click to summarize SrcArrayBufId

Specifies the input buffer which contains the X and Y positions of the four corners of the quadrilateral and the top-left and bottom-right corners of the rectangle. The buffer must be a one-dimensional floating-point buffer allocated with the M_ARRAY attribute, containing 12 entries.

The buffer must contain 12 entries; each entry corresponds to one of the following points.

Entry and its corresponding point

Entry and its corresponding point

entry [0] = X1

entry [6] = X4

entry [1] = Y1

entry [7] = Y4

entry [2] = X2

entry [8] = X1'

entry [3] = Y2

entry [9] = Y1'

entry [4] = X3

entry [10] = X3'

entry [5] = Y3

entry [11] = Y3'

(summarize)
Click to summarize DstXLutOrArrayBufId

Specifies the buffer in which to place the generated coefficients or X-component LUT entries.

(summarize)
Click to summarize MIL array buffer identifier

Specifies the MIL array buffer identifier. The buffer must be a 3x3 floating-point buffer allocated with an M_ARRAY attribute.

(summarize)
Click to summarize MIL LUT buffer identifier

Specifies the MIL LUT buffer identifier. The buffer must be a signed 16- or 32-bit integer buffer with an M_LUT attribute and the same X-size as the destination image buffer that will be passed to MimWarp().

(summarize)
Click to summarize DstYLutBufId

Specifies the buffer in which to place the Y-component LUT entries.

Note that if you want to generate coefficients and not LUTs, this parameter must be set to M_NULL.

(summarize)
Click to summarize M_NULL

Specifies that the coefficients will be generated.

Click to summarize MIL LUT buffer identifier

Specifies the MIL LUT buffer identifier. The buffer must be a signed 16- or 32-bit integer buffer, which has an M_LUT attribute and the same Y-size as the destination image buffer that will be passed to MimWarp().

(summarize)
Click to summarize M_WARP_4_CORNER_REVERSE +

Generates coefficients or LUT values for a perspective polynomial warping which, when passed to MimWarp(), maps a rectangle onto an arbitrary quadrilateral.

(summarize)
Click to summarize SrcArrayBufId

Specifies the input buffer which contains the X and Y positions of the four corners of the quadrilateral and the top-left and bottom-right corners of the rectangle. The buffer must be a one dimensional floating-point buffer allocated with the M_ARRAY attribute, containing 12 entries.

The buffer must contain 12 entries; each entry corresponds to one of the following points.

Entry and its corresponding point

Entry and its corresponding point

entry [0] = X1

entry [6] = X4

entry [1] = Y1

entry [7] = Y4

entry [2] = X2

entry [8] = X1'

entry [3] = Y2

entry [9] = Y1'

entry [4] = X3

entry [10] = X3'

entry [5] = Y3

entry [11] = Y3'

(summarize)
Click to summarize DstXLutOrArrayBufId

Specifies the buffer in which to place the generated coefficients or X-component LUT entries.

(summarize)
Click to summarize MIL array buffer identifier

Specifies the MIL array buffer identifier. The buffer must be a 3x3 floating-point buffer allocated with an M_ARRAY attribute.

(summarize)
Click to summarize MIL LUT buffer identifier

Specifies the MIL LUT buffer identifier. The buffer must be a signed 16- or 32-bit integer buffer with an M_LUT attribute and the same X-size as the destination image buffer that will be passed to MimWarp().

(summarize)
Click to summarize DstYLutBufId

Specifies the buffer in which to place the Y-component LUT entries.

Note that If you wish to generate coefficients and not LUTs, this parameter must be set to M_NULL.

(summarize)
Click to summarize M_NULL

Specifies that the coefficients will be generated.

Click to summarize MIL LUT buffer identifier

Specifies a signed 16- or 32-bit integer buffer, which has an M_LUT attribute and the same Y-size as the destination image buffer that will be passed to MimWarp().

Click to summarize M_WARP_LUT +

Generates LUTs that can be passed to MimWarp() to perform a warping that is equivalent to the warping that would be performed if the coefficients specified in the SrcArrayBufId parameter were used instead.

(summarize)
Click to summarize SrcArrayBufId

Specifies the input buffer which contains the coefficients of the polynomial equations used to perform the warping. The buffer must be a 3x3 floating-point buffer with an M_ARRAY attribute. The first row specifies the a n coefficients, the second row specifies the b n coefficients, and the third row specifies the c n coefficients.

(summarize)
Click to summarize DstXLutOrArrayBufId

Specifies a signed 16- or 32-bit integer buffer, which has an M_LUT attribute and the same X-size as the destination image buffer that will be passed to MimWarp().

(summarize)
Click to summarize DstYLutBufId

Specifies a signed 16- or 32-bit integer buffer, which has an M_LUT attribute and the same Y-size as the destination image buffer that will be passed to MimWarp().

(summarize)
Click to summarize M_WARP_POLYNOMIAL

Generates coefficients that can be passed to MimWarp() to perform a first-order polynomial warping.

(summarize)
Click to summarize SrcArrayBufId

Specifies the input buffer containing the coefficients generated by a previous call to MgenWarpParameter(). The values generated by any subsequent call to this function can be combined with the values contained in this buffer. The resulting coefficients can be passed to MimWarp() to perform a composite warp (for example, a rotation and translation).

Note that if this is your first call to MgenWarpParameter() this parameter must be set to M_NULL.

(summarize)
Click to summarize M_NULL

Specifies that this is the first call to MgenWarpParameter().

Click to summarize MIL array buffer identifier

Specifies a MIL array buffer identifier. The buffer must be a 3x3 floating-point buffer with an M_ARRAY attribute.

(summarize)
Click to summarize DstXLutOrArrayBufId

Specifies the identifier of a 3x3 floating-point buffer with an M_ARRAY attribute in which to place the generated coefficients. The resulting coefficients can be passed to MimWarp() to perform a composite warp (for example, a rotation and translation).

(summarize)
Click to summarize DstYLutBufId

Specifies to ignore this parameter. This parameter must be set to M_NULL when performing an M_WARP_POLYNOMIAL operation.

(summarize)

You can add the following value to the above-mentioned values to specify the number of fractional bits for the source address.

function map For the output LUT buffers
Click to summarizeCombination value Description
Click to summarize M_FIXED_POINT + n

Specifies the number of fractional bits for the source address (x s , y s). The default value is 0.

Note that when using this combination constant with M_WARP_4_CORNER or M_WARP_4_CORNER_REVERSE, the destination buffers (DstXLutOrArrayBufId and DstYLutBufId) must be LUT buffers (similar to when using M_WARP_LUT).

(summarize)
Compilation information
Header Include mil.h.
Library Use mil.lib.
DLL Requires mil.dll.
FLOAT FLOAT ROTATE SCALE SHEAR X SHEAR Y TRANSLATE WARP 4 CORNER FLOAT FLOAT NULL WARP 4 CORNER REVERSE FLOAT FLOAT NULL WARP LUT FLOAT WARP POLYNOMIAL NULL FLOAT FLOAT NULL FIXED POINT n M_FIXED_POINT + n