| Customize Help
| Save Settings

MmetCalculate



Function Map
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. For physically measured features, MmetCalculate() uses the target image's edge map. For more information on edge maps, see the Extracting the edges section of Chapter 9: Edge Finder.

If a metrology context contains only constructed features, the TargetBufId parameter can be set to M_NULL. This is useful, for example, when performing calculations on edgel features constructed from edgels or points established using other MIL modules or third party software.

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 camera 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 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
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 physically measured features and validate geometric tolerances. If a metrology context contains features which are only constructed, you can set this parameter to M_NULL. If you don't provide a target image and the context contains any measured features, an error is generated.

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