| MIL 10 Reference
| Customize Help
| Save Settings

McalWarp



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
Define the mapping characteristics of a calibration context according to an existing calibration context.
Syntax
void McalWarp(
MIL_ID SrcImageOrContextCalId, //in
MIL_ID DstImageOrContextCalId, //in
MIL_ID WarpParam1Id, //in
MIL_ID WarpParam2Id, //in
MIL_DOUBLE OffsetX, //in
MIL_DOUBLE OffsetY, //in
MIL_DOUBLE SizeX, //in
MIL_DOUBLE SizeY, //in
MIL_INT RowNumber, //in
MIL_INT ColumnNumber, //in
MIL_INT64 TransformationType, //in
MIL_INT64 ControlFlag //in
)
Description

This function defines the mapping of a calibration context according to a previously configured calibration context. Note that the calibration mode of the destination calibration context need not necessarily be the same as the calibration mode of the source context. The resulting mapping will be an accurate approximation of the source mapping for the specified image or context. This can be used, for example, to approximate a complex calibration using a constant pixel size calibration, simplifying further calculations.

This function can also be used to generate a new context by warping a previously calibrated context. The resulting context can then be associated with the uncalibrated warped image. This can be used, for example, to calibrate an image that has been warped using MimWarp(). MimWarp() returns an uncalibrated image which can then be associated (using McalAssociate()) with the newly warped calibration context.

To define new mapping that will only apply to a specific region of an image, use the OffsetX, OffsetY, SizeX and SizeY parameters. The mapping of the new calibration context will apply only to this defined area. See the description of these paramters in the Paramters section located below for more information.

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
SrcImageOrContextCalId

Specifies the identifier of the calibration context, calibrated image, or corrected image From which the source mapping is taken.

Note that the underlying source calibration context must have been previously configured using a successful call to McalGrid(), McalList(), McalUniform(), or McalWarp().

DstImageOrContextCalId

Specifies the identifier of the destination calibration context or image buffer.

When the identifier of a destination calibration context is specified, the calibration context must have been allocated using McalAlloc() with M_UNIFORM_TRANSFORMATION, M_LINEAR_INTERPOLATION, or M_PERSPECTIVE_TRANSFORMATION, that is, the calibration mode of the context must be 2D.

When an identifier of an image buffer is specified, the default uniform calibration context (M_DEFAULT_UNIFORM_CALIBRATION) will be associated to the image, and the M_UNIFORM_TRANSFORMATION calibration mode will be assumed. Any current calibration context associated to the image is ignored.

If the operation fails, the image will be uncalibrated. In-place processing is supported, that is, DstImageOrContextCalId can be the same identifier as SrcImageOrContextCalId.

WarpParam1Id

Specifies the buffer containing the matrix of coefficients or the LUT buffer from which source X-coordinates are determined.

If specifying a matrix of coefficients, the buffer must be a single-band, 32-bit floating-point buffer that has an M_ARRAY attribute and that has dimensions 3x2 or 3x3.

If specifying a LUT buffer, then the buffer must be a signed 16- or 32-bit integer buffer and have an M_LUT attribute.

If no warping of the source calibration context is required, set WarpParam1Id to M_NULL.

Please refer to MimWarp() for more information on this parameter.

WarpParam2Id

Specifies the LUT buffer from which source Y-coordinates are determined.

This buffer must be a single-band, signed 16- or 32-bit integer buffer and have an M_LUT attribute. The buffer must also have the same type and dimensions as WarpParam1Id.

If no warping is applied to the source calibration context, or if you are not using LUTs to perform the warping, set WarpParam2Id to M_NULL.

Please refer to MimWarp() for more information on this parameter.

OffsetX

Specifies the X pixel coordinate of the top-left calibration point.

If the calibration context has been warped, then it refers to the coordinate in the newly warped object.

OffsetY

Specifies the Y pixel coordinate of the top-left calibration point.

If the calibration context has been warped, then it refers to the coordinate in the newly warped object.

SizeX

Specifies the width of the grid of calibration points, in pixels.

SizeX must be set to a value > 1.0.

However, if TransformationType is set to M_WARP_LUT, SizeX can be set to M_NULL to indicate that the width specified by the LUTs should be used. In this case, OffsetX, OffsetY, SizeX and SizeY must all be set to M_NULL.

SizeY

Specifies the height of the grid of calibration points, in pixels.

SizeY must be set to a value > 1.0.

However, if TransformationType is set to M_WARP_LUT, SizeY can be set to M_NULL to indicate that the width specified be the LUTs should be used. In this case, OffsetX, OffsetY, SizeX and SizeY must all be set to M_NULL.

RowNumber

Specifies the number of rows of calibration points to be used for calibration.

Depending on the calibration mode of the destination calibration context or image, the operation requires that enough calibration points be present. For calibration contexts allocated using McalAlloc with M_UNIFORM_TRANSFORMATION and M_LINEAR_INTERPOLATION calibration modes, the minimum number of calibration points required is 3. For the M_PERSPECTIVE_TRANSFORMATION calibration mode, the minimum number of calibration points required is 4. Accuracy increases with the number of points.

function map For specifying the number of rows:
CollapseValue Description
Collapse M_DEFAULT

Specifies the default value; the default value is 15.

Collapse Value >= 2

Specifies the number of rows of calibration points to be used for calibration.

ColumnNumber

Specifies the number of columns of calibration points to be used for calibration.

Depending on the calibration mode of the destination calibration context or image, the operation requires that enough calibration points be present. For calibration contexts allocated using McalAlloc with M_UNIFORM_TRANSFORMATION and M_LINEAR_INTERPOLATION calibration modes, the minimum number of calibration points required is 3. For the M_PERSPECTIVE_TRANSFORMATION calibration mode, the minimum number of calibration points required is 4. Accuracy increases with the number of points.

function map For specifying the number of columns:
CollapseValue Description
Collapse M_DEFAULT

Specifies the default value; the default value is 15.

Collapse Value >= 2

Specifies the number of columns of calibration points to be used for calibration.

TransformationType

Specifies the type of transformation. This parameter must be set to one of the following values.

function map For specifying the type of transformation:
CollapseValue Description
Collapse M_IDENTITY

No transformation is performed. This is used when McalWarp approximates a new calibration context based on a source calibration context. In such cases, WarpParam1Id and WarpParam2Id must be set to M_NULL.

(summarize)
Collapse M_WARP_LUT +

Performs the warping through LUTs. In such cases, WarpParam1Id and WarpParam2Id must be buffers allocated with the M_LUT attribute.

(summarize)
Collapse M_WARP_POLYNOMIAL

Performs the warping using a 3x3 coefficient matrix. This includes first-order polynomial warping or perspective polynomial warping. In such cases, WarpParam1Id must indicate a buffer having the M_ARRAY attribute and WarpParam2Id must be set to M_NULL.

(summarize)
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 specifying fractional bits
CollapseCombination value Description
Collapse M_FIXED_POINT + n

Specifies the number of fractional bits for source coordinates. 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.

(summarize)
ControlFlag

Reserved for future expansion and must be set to M_DEFAULT.

Compilation information
Header Include mil.h.
Library Use mil.lib; milcal.lib.
DLL Requires mil.dll; milcal.dll.
TRUE PROC NULL PROC LINEAR INTERPOLATION PERSPECTIVE TRANSFORMATION UNIFORM TRANSFORMATION PROC FLOAT SIGNED SIGNED DEFAULT DEFAULT IDENTITY WARP LUT WARP POLYNOMIAL FIXED POINT n