Skip to main content

MgenWarpParameter

BoardSupported
Host SystemYes
V4L2Yes
Clarity UHDYes
Concord PoENo
GenTLYes
GevIQYes
GigE VisionYes
IndioNo
Iris GTXYes
Radient eV-CLYes
Rapixo CLYes
Rapixo CoFYes
Rapixo CXPYes
USB3 VisionYes

Generate coefficients or LUTs used to warp an image.

Syntax

void MgenWarpParameter(
AIL_ID SrcArrayBufId, //in
AIL_ID DstXLutOrArrayBufId, //out
AIL_ID DstYLutBufId, //out
AIL_INT OperationMode, //in
AIL_INT Transform, //in
AIL_DOUBLE Val1, //in
AIL_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 an M_WARP_4_CORNER or an 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_ <sub>d</sub>,_y_ <sub>d</sub>) is associated with a specific point in the source buffer, (_x_ <sub>s</sub>,_y_ <sub>s</sub>), according to the following equation:

[Image: mgenwarpparameter_eq1.png]

Where _xs _ and _ys _ are defined as follows:

[Image: MgenWarpParameter_Eq2.png]

[Image: MgenWarpParameter_Eq2(2).png]

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:

[Image: MgenWarpParameter_Eq3.png]

[Image: MgenWarpParameter_Eq3(2).png]

Parameters

SrcArrayBufId (in, AIL_ID)

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.

DstXLutOrArrayBufId (out, AIL_ID)

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

DstYLutBufId (out, AIL_ID)

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

OperationMode (in, AIL_INT)

Specifies the mode of operation.

Transform (in, AIL_INT)

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.

For specifying the type of first-order polynomial warping

ValueDescription
M_ROTATEGenerates coefficients for a counter-clockwise rotation around (0,0) by Val1°.
M_SCALEGenerates coefficients for an image scaling, by a factor of Val1 in the X-direction and by a factor of Val2 in the Y-direction.
M_SHEAR_XGenerates coefficients or for a shearing in the X-direction, by a factor of Val1.
M_SHEAR_YGenerates coefficients for a shearing in the Y-direction, by a factor of Val1.
M_TRANSLATEGenerates coefficients for a translation by Val1 pixels in the X-direction and by Val2 pixels in the Y-direction.

Val1 (in, AIL_DOUBLE)

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

Val2 (in, AIL_DOUBLE)

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

Parameter Associations

For selecting the operation mode


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. [Image: persp_warp_4_corner.png]

ValueDescription
Array buffer identifierSpecifies the Aurora Imaging Library array buffer identifier. The buffer must be a 3x3 floating-point buffer allocated with an M_ARRAY attribute.
LUT buffer identifierSpecifies the Aurora Imaging Library LUT buffer identifier. The buffer must be a signed 16- or 32-bit integer buffer or a 32-bit floating-point buffer with an M_LUT attribute and the same X-size as the destination image buffer that will be passed to MimWarp.
M_NULLSpecifies that the coefficients will be generated.
LUT buffer identifierSpecifies the Aurora Imaging Library LUT buffer identifier. The buffer must be a signed 16- or 32-bit integer buffer or a 32-bit floating-point buffer, which has an M_LUT attribute and the same Y-size as the destination image buffer that will be passed to MimWarp.

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. [Image: persp_warp_4_corner_reverse.png]

ValueDescription
Array buffer identifierSpecifies the Aurora Imaging Library array buffer identifier. The buffer must be a 3x3 floating-point buffer allocated with an M_ARRAY attribute.
LUT buffer identifierSpecifies the Aurora Imaging Library LUT buffer identifier. The buffer must be a signed 16- or 32-bit integer buffer or a 32-bit floating-point buffer with an M_LUT attribute and the same X-size as the destination image buffer that will be passed to MimWarp.
M_NULLSpecifies that the coefficients will be generated.
LUT buffer identifierSpecifies a signed 16- or 32-bit integer buffer or a 32-bit floating-point buffer, which has an M_LUT attribute and the same Y-size as the destination image buffer that will be passed to MimWarp.

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.


M_WARP_POLYNOMIAL

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

ValueDescription
M_NULLSpecifies that this is the first call to MgenWarpParameter.
Array buffer identifierSpecifies an Aurora Imaging Library array buffer identifier. The buffer must be a 3x3 floating-point buffer with an M_ARRAY attribute.

Combination Constants — For the output LUT buffers

Optional.

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

ValueDescription
M_FIXED_POINT + nSpecifies the number of fractional bits for the source address (_x_ <sub>s</sub>,_y_ <sub>s</sub>). 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).
Copyright © 2026 Zebra Technologies.