| MIL 10 Reference
| Customize Help
| Save Settings

McalTransformCoordinate



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
Synopsis
Convert coordinates between their world and pixel values.
Syntax
void McalTransformCoordinate(
MIL_ID CalibrationOrImageId, //in
MIL_INT64 TransformType, //in
MIL_DOUBLE X, //in
MIL_DOUBLE Y, //in
MIL_DOUBLE *ResXPtr, //out
MIL_DOUBLE *ResYPtr //out
)
Description

This function converts a pair of coordinates from their pixel value to their world value (or vice versa). The conversion can be performed according to a calibration context, calibrated image, or corrected image.

Note that, if you changed the origin and/or orientation of the relative coordinate system (using McalRelativeOrigin() or McalSetCoordinateSystem()), world coordinates will be returned, or assumed to be given, with respect to this relative coordinate system.

This function converts the coordinates of a point by making a line connecting the center of the camera's lens with the point provided, and then finding the intersection of that line with the required plane. To convert an image pixel to a world point, this function defines a line connecting the center of the camera's lens with the image plane, and then returns the intersection of this line with the world plane.

However, if the image plane is not parallel to the relative coordinate system, due to the camera setup or a displacement of the relative coordinate system, not every point in the image plane will have a valid real-world equivalent. Three types of intersections can occur when transforming from the image plane to the world plane. If the specified point in the image plane corresponds to a point in front of the camera and in the relative coordinate system, that point in the relative coordinate system is returned. However, if the line traced through the specified point in the image plane does not intersect the XY (Z=0) plane of the relative coordinate system, M_INVALID_POINT is returned since there is no intersection. If the line's intersection with the XY (Z=0) plane of the relative coordinate system is behind the camera, then the mathematically computed value is returned, even though it is not the correct world location of the point specified in the image.

However, using M_NO_POINTS_BEHIND_CAMERA returns M_INVALID_POINT if the returned point is behind the camera.

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
CalibrationOrImageId

Specifies the identifier of the calibration context, calibrated image, or corrected image.

If you are transforming coordinates obtained from a calibrated image, you can either pass the identifier of the image or that of its calibration context. However, if the coordinates are obtained from a child buffer, you must pass the identifier of the child buffer.

TransformType

Specifies whether to perform a pixel-to-world or world-to-pixel conversion. This parameter must be set to one of the following values:

function map For specifying pixel-to-world or world-to-pixel
CollapseValue Description
Collapse M_PIXEL_TO_WORLD +

Converts from pixel to world.

Collapse M_WORLD_TO_PIXEL +

Converts from world to pixel.

Combination constants for any of the possible values of the TransformType parameter.

You can add one of the following values to the above-mentioned values to specify the return of invalid points.

function map For specifying to return invalid points
CollapseCombination value Description
Collapse M_NO_EXTRAPOLATED_POINTS

Specifies that if a pixel involved in the transformation is not inside the calibrated region, M_INVALID_POINT will be returned, instead of a coordinate resulting from the extrapolation. The calibrated region is defined as the image region covered by the calibration grid. This region can be displayed by calling McalDraw() with M_DRAW_VALID_REGION.

This combination value only applies to piecewise linear calibrations (M_LINEAR_INTERPOLATION); if this combination value is specified and the object passed to CalibrationOrImageId has any other type of calibration, this combination value is ignored.

(summarize)
Collapse M_NO_POINTS_BEHIND_CAMERA

Specifies that M_INVALID_POINT is returned when a computed point is mathematically valid but physically impossible (behind the camera).

If this value does not apply to the specified transformation type, then it is ignored.

(summarize)
X

Specifies the X-coordinate of the input.

Y

Specifies the Y-coordinate of the input.

ResXPtr

Specifies the address of the variable in which to place the returned value of the X-coordinate. One of the following can be written to the address.

function map For specifying the potential return values of the X-coordinate
CollapseValue Description
Collapse M_INVALID_POINT

Specifies a non-valid coordinate.

Collapse Value

Specifies the transformed X-coordinate as a value.

ResYPtr

Specifies the addres of the variable in which to place the returned value of the Y-coordinate. One of the following can be written to the address.

function map For specifying the potential return values of the Y-coordinate
CollapseValue Description
Collapse M_INVALID_POINT

Specifies a non-valid coordinate.

Collapse Value

Specifies the transformed Y-coordinate as a value.

Compilation information
Header Include mil.h.
Library Use mil.lib; milcal.lib.
DLL Requires mil.dll; milcal.dll.
NULL PROC TRUE PROC PIXEL TO WORLD WORLD TO PIXEL NO EXTRAPOLATED POINTS NO POINTS BEHIND CAMERA INVALID POINT INVALID POINT