| MIL 10 Reference
| Customize Help
| Save Settings

MgenWarpParameter



See also
Availability
Not available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Next
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 by passing a matrix of coefficients to MgenWarpParameter() with OperationMode set to M_WARP_4_CORNER, or M_WARP_4_CORNER_REVERSE, the coefficients that were passed to the function will not be saved. In order 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, coefficients or LUTs can be generated 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. After all the coefficients are generated, pass the coefficient buffer to MimWarp().

For a perspective polynomial warping, coefficients or LUTs can be generated to map an arbitrary quadrilateral onto a rectangle or vice versa. After all the coefficients or LUT values are generated, pass the coefficient or LUT buffers to MimWarp().

First-order polynomial warpings and perspective polynomial warpings are performed by associating each pixel position of the destination buffer, (x d,y d), 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 if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
SrcArrayBufId

Specifies the input buffer from which to generate coefficients or LUT entries.

When generating coefficients or LUTs for a first-order polynomial warping, set SrcArrayBufId to M_NULL if this is your first call to MgenWarpParameter(). If you are combining coefficients and this is a second (or later) call, set SrcArrayBufId to the identifier of the previous output buffer.

When generating LUTs to be used by MimWarp() using M_WARP_LUT, SrcArrayBufId must be set to the identifier of a 3x3 floating-point buffer that has 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.

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 the DstYLutBufId 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
CollapseValue Description
Collapse M_ROTATE

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

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

Collapse M_SHEAR_X

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

Collapse M_SHEAR_Y

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

Collapse 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
CollapseOperationMode Description
SrcArrayBufId
DstXLutOrArrayBufId
DstYLutBufId
Collapse 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. When generating coefficients or LUTs for perspective warpings that map an arbitrary quadrilateral onto a rectangle, SrcArrayBufId must be set to the identifier of a one-dimensional floating-point buffer with an M_ARRAY attribute.

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)
Collapse SrcArrayBufId

Specifies the input buffer from which to generate coefficients or LUT values. It must be a one dimensional floating-point buffer allocated with the M_ARRAY attribute, containing 12 entries. The entries correspond to the X and Y positions of the four corners of the quadrilateral and the top left and bottom right corners of the rectangle.

(summarize)
Collapse DstXLutOrArrayBufId

Specifies the buffer in which to place the generated coefficients or X-component LUT entries. It must be either a 3x3 floating-point buffer allocated with an M_ARRAY attribute, or 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)
Collapse 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().

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

(summarize)
Collapse 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. When generating coefficients or LUTs for perspective warpings that map a rectangle onto an arbitrary quadrilateral, SrcArrayBufId must be set to the identifier of a one-dimensional floating-point buffer with an M_ARRAY attribute.

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)
Collapse SrcArrayBufId

Specifies the input buffer from which to generate coefficients or LUT values. It must be a one dimensional floating-point buffer allocated with the M_ARRAY attribute, containing 12 entries. The entries correspond to the X and Y positions of the four corners of the quadrilateral and the top left and bottom right corners of the rectangle.

(summarize)
Collapse DstXLutOrArrayBufId

Specifies the buffer in which to place the generated coefficients or X-component LUT entries. It must be either a 3x3 floating-point buffer allocated with an M_ARRAY attribute, or 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)
Collapse 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().

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

(summarize)
Collapse M_WARP_LUT +

Generates LUTs to be passed to MimWarp() to perform a first-order polynomial warping or a perspective polynomial warping.

(summarize)
Collapse SrcArrayBufId

Specifies the identifier of a 3x3 floating-point buffer with an M_ARRAY attribute. The values contained in the array specify the coefficients of the polynomial equations used to perform the warping.

(summarize)
Collapse 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)
Collapse 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)
Collapse M_WARP_POLYNOMIAL

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

(summarize)
Collapse SrcArrayBufId

Specifies the input buffer needed to combine coefficients. It must be a 3x3 floating-point buffer with an M_ARRAY attribute. The values generated by the subsequent call to this function will 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)
Collapse DstXLutOrArrayBufId

Specifies the identifier of a 3x3 floating-point buffer with an M_ARRAY attribute in which to place the generated coefficients. The values contained in the array specify the coefficients of the polynomial equations used to perform the warping.

(summarize)
Collapse DstYLutBufId

This Parameter must be set to M_NULL when in M_WARP_POLYNOMIAL mode.

(summarize)
Collapse M_NULL

Specifies that this parameter will not be used.

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
CollapseCombination value Description
Collapse 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 WARP 4 CORNER REVERSE FLOAT FLOAT WARP LUT FLOAT WARP POLYNOMIAL FLOAT FLOAT NULL FIXED POINT n