Skip to main content

MimWarp

BoardSupported
Host SystemYes
V4L2Yes
Clarity UHDYes
Concord PoENo
GenTLYes
GevIQYes
GigE VisionYes
IndioNo
Iris GTXYes
Radient eV-CLPartial
Rapixo CLPartial
Rapixo CoFPartial
Rapixo CXPPartial
USB3 VisionYes

Perform a warping.

Syntax

void MimWarp(
AIL_ID SrcImageBufId, //in
AIL_ID DstImageBufId, //out
AIL_ID WarpParam1BufId, //in
AIL_ID WarpParam2BufId, //in
AIL_INT64 OperationMode, //in
AIL_INT64 InterpolationMode //in
)

Description

This function warps an image through either a 3x3 matrix-defined warping or LUTs. You can perform first-order polynomial warpings or perspective polynomial warpings using either a 3x3 coefficients matrix or lookup tables (LUTs). You can perform custom warpings using LUTs.

A warping associates each pixel position of the destination buffer, (_xd, yd _), with a specific point in the source buffer, (_xs, ys _), and then determines the pixel value of (_xd, yd _) from its associated point and from a specified interpolation mode.

When performing a first-order polynomial warping, (_xd, yd _) gets associated with (_xs, ys _) through the following equations:

_x_ <sub>s</sub> = a<sub>0</sub> _x_ <sub>d</sub> + a<sub>1</sub> _y_ <sub>d</sub> + a<sub>2</sub>

_y_ <sub>s</sub> = b<sub>0</sub> _x_ <sub>d</sub> + b<sub>1</sub> _y_ <sub>d</sub> + b<sub>2</sub>

When performing a perspective polynomial warping, (_xd, yd _) gets associated with (_xs, ys _) through the following equations:

_x_ <sub>s</sub> = (a<sub>0</sub> _x_ <sub>d</sub> + a<sub>1</sub> _y_ <sub>d</sub> + a<sub>2</sub>)/(c<sub>0</sub> _x_ <sub>d</sub> + c<sub>1</sub> _y_ <sub>d</sub> + c<sub>2</sub>)

_y_ <sub>s</sub> = (b<sub>0</sub> _x_ <sub>d</sub> + b<sub>1</sub> _y_ <sub>d</sub> + b<sub>2</sub>)/(c<sub>0</sub> _x_ <sub>d</sub> + c<sub>1</sub> _y_ <sub>d</sub> + c<sub>2</sub>)

When performing a 3x3 matrix-defined warping, WarpParam1BufId specifies the required coefficients (_a0...a2, b0...b2 _) or (_a0...a2, b0...b2, c0...c2 _) and WarpParam2BufId must be set to M_NULL. The coefficients can be automatically generated using MgenWarpParameter or can be user-supplied.

When performing a warping using LUTs, _xs _is determined from (_xd, yd _) through one LUT and _ys _ is determined from (_xd, yd _) through another LUT. In this case, WarpParam1BufId specifies the LUT for _xs _ and WarpParam2BufId specifies the LUT for _ys _. The LUTs can be user-supplied or can be automatically generated from a 3x3 coefficient matrix (for a first-order or polynomial warping) using MgenWarpParameter.

Parameters

SrcImageBufId (in, AIL_ID)

Specifies the buffer on which to perform the warping. This buffer can be of any type.

DstImageBufId (out, AIL_ID)

Specifies the buffer in which to place the results of the warping. This buffer can be of any type.

WarpParam1BufId (in, AIL_ID)

Specifies the buffer containing the matrix coefficients or the LUT buffer from which _x_ <sub>s</sub> is determined.

WarpParam2BufId (in, AIL_ID)

Specifies the LUT buffer from which _y_ <sub>s</sub> is determined. This buffer must be a signed 16- or 32-bit integer buffer or a 32-bit floating-point buffer, have the same X and Y size as the destination image buffer, and have an M_LUT attribute.

OperationMode (in, AIL_INT64)

Specifies the mode of operation. This parameter must be set to one of the values below.

For specifying the mode of operation

ValueDescription
M_WARP_LUTPerforms the warping through LUTs.
M_WARP_POLYNOMIALPerforms the warping through a 3x3 coefficient matrix. This includes a first-order polynomial warping or a perspective polynomial warping.

Note that with a perspective polynomial warping matrix, MimWarp might return an error if the calculation of _(c0xd + c1yd + c2)_is 0 in the destination buffer, regardless of whether or not the matrix was generated using MgenWarpParameter. |

For

ValueDescription
M_FIXED_POINT + nSpecifies the number of fractional bits for the source point (_x_ <sub>s</sub>, _y_ <sub>s</sub>). To do so, add the define M_FIXED_POINT + n to M_WARP_LUT where _n_ >= 0.

If nothing is added to M_WARP_LUT, it is assumed that there are no fractional bits in the coordinates of the source point (and therefore interpolation is not required). |

InterpolationMode (in, AIL_INT64)

Specifies the interpolation mode. This parameter must be set to one of the values below.

For specifying the interpolation mode

ValueDescription
M_DEFAULTSame as M_NEAREST_NEIGHBOR + M_OVERSCAN_ENABLE.
M_BICUBICSpecifies bicubic interpolation. The new value is determined by taking a weighted average of the 16 values (4x4) that surround the source point. Note that the sum of the weights used for bicubic interpolation might be greater than one. If this occurs and the result reflects an overflow or underflow, the result is saturated according to the depth and data type of the destination buffer.
M_BILINEARSpecifies bilinear interpolation. The new value is determined by taking a weighted average of the 4 values (2x2) that surround the source point.
M_NEAREST_NEIGHBORSpecifies nearest neighbor interpolation. The new value is that of the pixel closest to the source point.

For overscan

ValueDescription
M_OVERSCAN_CLEARSets the destination pixel to 0, if the associated point falls outside the source buffer.
M_OVERSCAN_DISABLELeaves the destination pixel as is.
M_OVERSCAN_ENABLE (default)Uses pixels from the source buffer's ancestor buffer. If the source buffer is not a child buffer or if the point falls outside the ancestor buffer, leave the destination pixel as is.
M_OVERSCAN_FASTSpecifies that Aurora Imaging Library will automatically select the overscan that optimizes speed, according to the specified operation and the target system. The overscan could be hardware-specific thereby having a different behavior than the other supported overscan modes.

Note that when using M_OVERSCAN_FAST, the destination pixels in the overscan area are undefined. The pixels can therefore contain different values from one function call to the next, even if the function's parameter values are the same. |

Copyright © 2026 Zebra Technologies.