| MIL 10 Reference
| Customize Help
| Save Settings

MmetCalculate



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
Calculate features and validate geometric tolerances.
Syntax
void MmetCalculate(
MIL_ID ContextId, //in
MIL_ID TargetBufId, //in
MIL_ID ResultId, //in
MIL_INT64 ControlFlag //in
)
Description

This function calculates features and validates geometric tolerances in the target image buffer. To do so, MmetCalculate() uses the target image's edge map. For more information on edge maps, see the Extracting the edges section of Chapter 8: Edge Finder.

To control the Metrology module's calculation and validation behavior, you can set context constraints using MmetControl(). You can also use MmetControl() to alter settings for features and tolerances that you have already added to the context. To add features to the context, use MmetAddFeature(). To add geometric tolerances to the context and define geometric relationships between features, use MmetAddTolerance().

Results of a metrology calculation are stored in the specified result buffer and can be obtained using MmetGetResult().

If the target image is not calibrated, results are calculated in the pixel coordinate system (pixel units). If the target image is calibrated, results are calculated in the world coordinate system (real-world units), but they can be retrieved in either world or pixel units. Note that, if the target image is calibrated, feature values, metrology regions, and tolerances are considered as real-world values and are retrieved in world units.

Note that in the presence of distortion, some results are meaningless when converted from real-world to pixel units (for example, angle and scale results). For example, if a feature appears warped in the target image, but the calibration context compensates for this during the calculation, the resulting angle is meaningful in the real-world coordinate system, and meaningless in the pixel coordinate system.

If complex distortions exist, you must first correct the image before using it with the Metrology module.

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
ContextId

Specifies the identifier of the metrology context. The metrology context must have been previously allocated on the required system using MmetAlloc().

TargetBufId

Specifies the identifier of the target image buffer from which to extract edges to calculate features and validate geometric tolerances. Typically, the target image buffer should be 1-band 8-bit unsigned. Other buffer depths and types are generally accepted, but can slightly decrease performance. When the target image buffer is 32-bit float, metrology uses floating-point precision calculations.

This image buffer must not have a region of interest (ROI) associated with it (MbufSetRegion()). Using an image buffer with an ROI will cause an error. You can only use metrology regions established with MmetSetRegion().

ResultId

Specifies the metrology result buffer in which to write the results of the calculation. The metrology result buffer must have been previously allocated on the required system using MmetAllocResult().

ControlFlag

Reserved for future expansion and must be set to M_DEFAULT.

Compilation information
Header Include mil.h.
Library Use mil.lib; milmetrol.lib.
DLL Requires mil.dll; milmetrol.dll.
PROC NONE