| MIL 10 Reference
| Customize Help
| Save Settings

MimWarp



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

Available on Windows
Available on Linux

Partially supported on:
Partially supported on Matrox GPU processing driver
Partially supported on Matrox Radient eCL
Partially supported on Matrox Radient eV-CXP
Partially supported on Matrox Solios eA/XA
Partially supported on Matrox Solios ecl/xcl/ev-cl

Fully supported on:
Fully supported on Host system
Fully supported on Matrox CronosPlus
Fully supported on Matrox GigE Vision driver
Fully supported on Matrox IEEE 1394 IIDC driver
Fully supported on Matrox Iris GT
Fully supported on Matrox Morphis
Fully supported on Matrox Morphis QxT
Fully supported on Matrox Orion HD
Fully supported on Matrox USB3 Vision driver (requires Update 19)
Fully supported on Matrox Vio

For any information regarding a MIL system added during a MIL Update, see the MIL system’s release note

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Perform a warping.
Syntax
void MimWarp(
MIL_ID SrcImageBufId, //in
MIL_ID DstImageBufId, //in
MIL_ID WarpParam1BufId, //in
MIL_ID WarpParam2BufId, //in
MIL_INT64 OperationMode, //in
MIL_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 s = a0 x d + a1 y d + a2 .

y s = b0 x d + b1 y d + b2 .

When performing a perspective polynomial warping, (xd, yd ) gets associated with (xs, ys ) through the following equations:

x s = (a0 x d + a1 y d + a2)/(c0 x d + c1 y d + c2).

y s = (b0 x d + b1 y d + b2)/(c0 x d + c1 y d + c2).

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().

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
SrcImageBufId

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

This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.

[Matrox GPU processing driver]

The source image buffer must be unsigned monochrome 8- or 16-bit, or M_BGR32 packed.

DstImageBufId

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

This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.

Note that after performing the operation, the destination image will not be calibrated, even if the source image was calibrated.

[Matrox GPU processing driver]

The destination image buffer must be unsigned monochrome 8- or 16-bit, or M_BGR32 packed.

WarpParam1BufId

Specifies the buffer containing the matrix coefficients or the LUT buffer from which x s is determined.

When WarpParam1BufId specifies the (a0...a2, b0...b2 ) or (a0...a2, b0...b2, c0...c2 ) coefficients, the coefficients must be in a single-band, 32-bit floating-point buffer that has an M_ARRAY attribute and that has dimensions 3x2 or 3x3. 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. If the buffer is 3x2, the third row is assumed to be (0, 0, 1).

When WarpParam1BufId specifies the LUT buffer from which x s is determined, the buffer must be a signed 16- or 32-bit integer buffer, have the same X and Y size as the destination image buffer, and have an M_LUT attribute.

WarpParam2BufId

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

If you are not using LUTs to perform the warping, set WarpParam2BufId to M_NULL.

OperationMode

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

function map For specifying the mode of operation
CollapseValue Description
MIL system-specific
tooltip (†)
Collapse M_WARP_LUT +

Performs the warping through LUTs.

(summarize)
a b c d e f g h i j k l m n o p q r s
MIL system specific

LUT buffers support signed 16-bit integers only.

d
Collapse M_WARP_POLYNOMIAL

Performs 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().

(summarize)
a b c d e f g h i j k l m n o p q r s
Combination constant for M_WARP_LUT.

You can add the following value to the above-mentioned value to specify the number of fractional bits in the coordinates of the source point.

function map For M_WARP_LUT
CollapseCombination value Description
Collapse M_FIXED_POINT + n

Specifies the number of fractional bits for the source point ( x s , y s ). 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).

(summarize)
InterpolationMode

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

function map For specifying the interpolation mode
CollapseValue Description
MIL system-specific
tooltip (†)
Collapse M_DEFAULT

Same as M_NEAREST_NEIGHBOR + M_OVERSCAN_ENABLE.

a b c d e f g h i j k l m n o p q r s
Collapse M_BICUBIC +

Specifies bicubic interpolation. When using bicubic interpolation, saturation is performed according to the type of the destination buffer.

(summarize)
a b c e f g h i j k l m n o p q r s
Collapse M_BILINEAR +

Specifies bilinear interpolation. No saturation is performed.

(summarize)
a b c d e f g h i j k l m n o p q r s
Collapse M_NEAREST_NEIGHBOR +

Specifies nearest neighbor interpolation. No saturation is performed.

(summarize)
a b c d e f g h i j k l m n o p q r s
Combination constants for any of the possible values of the InterpolationMode parameter.

You can add one of the following values to the above-mentioned values to specify how to determine the value of a destination pixel when its associated point falls outside the source buffer.

function map For overscan
CollapseCombination value Description
MIL system-specific
tooltip (†)
Collapse M_OVERSCAN_CLEAR

Sets the destination pixel to 0, if the associated point falls outside the source buffer.

a b c d e f g h i j k l m n o p q r s
Collapse M_OVERSCAN_DISABLE

Leaves the destination pixel as is.

a b c d e f g h i j k l m n o p q r s
Collapse M_OVERSCAN_ENABLE

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.

This is the default value.

(summarize)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Points falling outside the source image are undefined.

d j k l m p q r
Collapse M_OVERSCAN_FAST

Specifies that MIL 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.

(summarize)
a b c d e f g h i j k l m n o p q r s
Compilation information
Header Include mil.h.
Library Use mil.lib; milim.lib.
DLL Requires mil.dll; milim.dll.
PROC NONE PROC NONE SIGNED FLOAT SIGNED WARP LUT WARP POLYNOMIAL FIXED POINT n DEFAULT BICUBIC BILINEAR NEAREST NEIGHBOR OVERSCAN CLEAR OVERSCAN DISABLE OVERSCAN ENABLE OVERSCAN FAST