| Customize Help
| Save Settings

MimPolarTransform



Function Map
Synopsis
Perform a polar-to-rectangular or rectangular-to-polar transformation on an image or generate LUTs used to perform the transformation.
Syntax
void MimPolarTransform(
MIL_ID SrcImageOrDstXLutBufId, //in
MIL_ID DstImageOrYLutBufId, //in
MIL_DOUBLE CenterPosX, //in
MIL_DOUBLE CenterPosY, //in
MIL_DOUBLE StartRadius, //in
MIL_DOUBLE EndRadius, //in
MIL_DOUBLE StartAngle, //in
MIL_DOUBLE EndAngle, //in
MIL_INT64 OperationMode, //in
MIL_INT64 InterpolationMode, //in
MIL_DOUBLE *DstSizeXPtr, //out
MIL_DOUBLE *DstSizeYPtr //out
)
Description

This function performs a rectangular-to-polar or polar-to-rectangular transformation. Alternatively, this function can generate the X- and Y-coordinate LUTs required to perform the transformation using MimWarp().

For a rectangular-to-polar transformation, the zone of interest to convert is based on a circle centered at CenterPosX and CenterPosY, with the part to convert having the specified start and end radius (StartRadius and EndRadius) and specified start and end angle (StartAngle and EndAngle), measured with respect to the X-axis of the image.

The result will be mapped to the destination buffer as follows:

The increment in angle is determined by the length, in pixels, of the outside arc, calculated as follows:

(endangle - startangle) / arclength.

A polar-to-rectangular transform performs the reverse of the transform described above. It takes a polar buffer and maps it to a rectangular buffer. Use the CenterPosX, CenterPosY, StartAngle, EndAngle, StartRadius, EndRadius parameters to specify where in the destination buffer the contents of the polar buffer will be mapped.

To determine the required size of the destination image or LUT buffer, call the function with DstImageOrYLutBufId set to M_NULL; in this case, DstSizeXPtr and DstSizeYPtr will return the required X- and Y- size of the buffer, respectively. Note that DstSizeXPtr and DstSizeYPtr will return MIL_DOUBLE values; to allocate an appropriate buffer using these values, you should use a ceiling function, such as ceil(), to obtain the X- and Y- sizes as integer (MIL_INT) values.

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
SrcImageOrDstXLutBufId

Specifies the identifier of the source image buffer or the destination X-coordinate LUT buffer.

See the Parameter associations section for possible values that can be specified.

DstImageOrYLutBufId

Specifies the identifier of the destination image buffer or the Y-coordinate LUT buffer.

See the Parameter associations section for possible values that can be specified.

CenterPosX

Specifies the X-coordinate of the circle's center in the rectangular image.

CenterPosY

Specifies the Y-coordinate of the circle's center in the rectangular image.

StartRadius

Specifies the start radius of the zone of interest in the circle, in pixels.

EndRadius

Specifies the end radius of the zone of interest in the circle, in pixels.

StartAngle

Specifies the start angle of the zone of interest. The scan starts at this angle.

function map For specifying the starting angle
Click to summarizeValue Description
Click to summarize -360.0 <= Value <= 720.0

Specifies the start angle.

If the start angle (StartAngle) is less than the end angle (EndAngle), the direction of the scan will be counter clockwise. If the start angle is greater than the end angle, the direction of the scan will be clockwise. There is no maximum span limit between StartAngle and EndAngle.

(summarize)
EndAngle

Specifies the end angle of the zone of interest. The scan ends at this angle.

function map For specifying the ending angle
Click to summarizeValue Description
Click to summarize -360.0 <= Value <= 720.0

Specifies the end angle.

If the end angle (EndAngle) is greater than the start angle (StartAngle), the direction of the scan will be counter clockwise. If the end angle is less than the start angle, the direction of the scan will be clockwise. There is no maximum span limit between StartAngle and EndAngle.

(summarize)
OperationMode

Specifies the transform to perform.

See the Parameter associations section for possible values that can be specified.

InterpolationMode

Specifies the interpolation mode and overscan used when transforming the source image. When generating the LUTs to perform the transformation, this parameter is ignored and should be set to M_DEFAULT.

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

function map For specifying the interpolation mode used in the conversion
Click to summarizeValue Description MIL system-specific
tooltip (‡)
Click to summarize M_DEFAULT

Specifies the default interpolation mode and overscan. When transforming the source image, the default is the same as M_NEAREST_NEIGHBOR + M_OVERSCAN_ENABLE.

When only generating the LUTs to perform the transformation, this is the only possible value.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize M_BICUBIC +

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

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize M_BILINEAR +

Specifies bilinear interpolation. The new value is determined by taking a weighted average of the 4 values (2x2) that surround the source point.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize M_NEAREST_NEIGHBOR +

Specifies nearest neighbor interpolation. The new value is that of the pixel closest to the source point.

(summarize)
a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Combination values 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 specifying how to determine the value of a destination pixel when its associated point falls outside the source buffer
Click to summarizeCombination value Description MIL system-specific
tooltip (‡)
Click to summarize M_OVERSCAN_CLEAR

Sets the destination pixel to 0.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize M_OVERSCAN_DISABLE

Leaves the destination pixel as is.

a c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
Click to summarize 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 c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
MIL system specific

Points falling outside the source image are undefined.

j k
M10
l m p r
U27
y
U75
aa
Click to summarize 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 c
M10
g h i j k
M10
l m o p r
U27
t
U28
u
U36
v y
U75
aa
DstSizeXPtr

Specifies the address of the variable in which the required width of the destination buffer is written. If you don't need this information, set this parameter to M_NULL.

DstSizeYPtr

Specifies the address of the variable in which the required height of the destination buffer is written. If you don't need this information, set this parameter to M_NULL.

The table below lists possible values for the SrcImageOrDstXLutBufId, DstImageOrYLutBufId, and OperationMode parameters.

function map For selecting the Operation Mode
Click to summarizeOperationMode Description
SrcImageOrDstXLutBufId
DstImageOrYLutBufId
Click to summarize M_POLAR_TO_RECTANGULAR

Performs a polar-to-rectangular transformation.

(summarize)
Click to summarize SrcImageOrDstXLutBufId

Specifies the identifier of the source image buffer containing the polar image.

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

(summarize)
Click to summarize DstImageOrYLutBufId

Specifies the identifier of the destination buffer in which to store the transformed rectangular image. Use the CenterPosX, CenterPosY, StartAngle, EndAngle, StartRadius, EndRadius parameters to specify the zone in which to write the rectangular version of the polar image.

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

(summarize)
Click to summarize M_POLAR_TO_RECTANGULAR_LUT +

Generates X- and Y-coordinate LUTs for use with MimWarp() to perform the specified polar-to-rectangular transformation.

(summarize)
Click to summarize SrcImageOrDstXLutBufId

Specifies the identifier of the destination buffer in which to store the X-coordinate LUT. This buffer must be a signed 16- or 32-bit buffer with an M_LUT attribute.

(summarize)
Click to summarize DstImageOrYLutBufId

Specifies the identifier of the destination buffer in which to store the Y-coordinate LUT. This buffer must be a signed 16- or 32-bit buffer with an M_LUT attribute.

(summarize)
Click to summarize M_RECTANGULAR_TO_POLAR

Performs a rectangular-to-polar transformation.

(summarize)
Click to summarize SrcImageOrDstXLutBufId

Specifies the identifier of the source image buffer containing the rectangular image. Use the CenterPosX, CenterPosY, StartAngle, EndAngle, StartRadius, EndRadius parameters to define the image's zone of interest to transform.

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

(summarize)
Click to summarize DstImageOrYLutBufId

Specifies the identifier of the destination image buffer in which to place the transformed zone of interest. This image is a polar image.

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

(summarize)
Click to summarize M_RECTANGULAR_TO_POLAR_LUT +

Generates X- and Y-coordinate LUTs for use with MimWarp() to perform the specified rectangular-to-polar transformation.

(summarize)
Click to summarize SrcImageOrDstXLutBufId

Specifies the identifier of the destination buffer in which to store the X-coordinate LUT. This buffer must be a signed 16- or 32-bit buffer with an M_LUT attribute.

(summarize)
Click to summarize DstImageOrYLutBufId

Specifies the identifier of the destination buffer in which to store the Y-coordinate LUT. This buffer must be a signed 16- or 32-bit buffer with an M_LUT attribute.

(summarize)

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

function map For generating LUTs
Click to summarizeCombination value Description
Click to summarize 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_POLAR_TO_RECTANGULAR_LUT or M_RECTANGULAR_TO_POLAR_LUT where n >= 0.

If nothing is added to M_POLAR_TO_RECTANGULAR_LUT or M_RECTANGULAR_TO_POLAR_LUT, it is assumed that there are no fractional bits in the coordinates of the source point.

(summarize)
Compilation information
Header Include mil.h.
Library Use mil.lib; milim.lib.
DLL Requires mil.dll; milim.dll.
DEFAULT BICUBIC BILINEAR NEAREST NEIGHBOR OVERSCAN CLEAR OVERSCAN DISABLE OVERSCAN ENABLE OVERSCAN FAST POLAR TO RECTANGULAR PROC NONE PROC NONE POLAR TO RECTANGULAR LUT SIGNED SIGNED RECTANGULAR TO POLAR PROC NONE PROC NONE RECTANGULAR TO POLAR LUT SIGNED SIGNED FIXED POINT n M_FIXED_POINT + n