| MIL 10 Reference
| Customize Help
| Save Settings

MmodAlloc



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
Previous
Synopsis
Allocate a Model Finder context.
Syntax
MIL_ID MmodAlloc(
MIL_ID SystemId, //in
MIL_INT64 ModelFinderType, //in
MIL_INT64 ControlFlag, //in
MIL_ID *ContextIdPtr //out
)
Description

This function allocates a Model Finder context on the specified system. A Model Finder context contains all the information necessary to perform an MmodFind() search, including global search settings, and the individual model(s) to locate. When the Model Finder context is no longer required, you should release its memory, using MmodFree().

Models can be defined and added to a Model Finder context using MmodDefine().

The Model Finder context and individual model search settings can be adjusted using MmodControl().

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
SystemId INQ

Specifies the system on which to allocate the context. This parameter should be set to one of the following values:

function map For specifying the system identifier
CollapseValue Description
Collapse M_DEFAULT_HOST

Specifies the default Host system of the current MIL application.

Collapse MIL system identifier

Specifies a valid system identifier, previously allocated using MsysAlloc().

ModelFinderType INQ

Specifies the type of Model Finder context. This parameter must be set to one of the following values:

function map For the type of context
CollapseValue Description
Collapse M_GEOMETRIC

Specifies that the Model Finder context uses a general geometric search algorithm. This algorithm uses geometric features to locate user-specified model(s).

(summarize)
Collapse M_GEOMETRIC_CONTROLLED

Specifies that the Model Finder context uses a controlled geometric search algorithm.

This search method is recommended when there are only small differences in scale between the occurrence and the nominal scale of the model (M_SCALE). When there is a lot of geometric complexity, this search method is often faster and more robust than M_GEOMETRIC. The search method is especially fast when the angle between the occurrence and the nominal angle of the model (M_ANGLE) is small.

You can also set M_SEARCH_ANGLE_RANGE to M_ENABLE.

When using this type of Model Finder context, M_SEARCH_SCALE_RANGE is disabled by default and cannot be set to M_ENABLE. As well, you cannot get or draw the target edges for the entire target (M_GENERAL); you can only get or draw them in the region of an occurrence.

(summarize)
Collapse M_SHAPE_CIRCLE

Specifies that the Model Finder context uses a circular model search algorithm.

This context only supports M_CIRCLE type models, and only supports one model per context. The model cannot be calibrated and will inherit the calibration of the target image. If the target is associated with a calibration context, the model will be interpreted in world units, and conversely, if the target does not have a calibration context associated with it, the model will be interpreted in pixel units. When searching for the model, the target must be an image buffer; it cannot be an Edge Finder result buffer.

This search algorithm is recommended when the objects being sought are circular-type shapes, although the algorithm does have a tolerance for deformations of the circular shape. This deformation tolerance could include detecting certain elliptical type shapes as well as noisy circles. This search algorithm will typically find circular shapes faster and in a more robust manner than the search algorithms used for M_GEOMETRIC or M_GEOMETRIC_CONTROLLED types of Model Finder contexts.

When using this type of Model Finder context, M_SEARCH_ANGLE_RANGE and M_SEARCH_POSITION_RANGE are turned off by default and cannot be set to M_ENABLE. Whereas, the M_SEARCH_SCALE_RANGE is set to M_ENABLE by default. When using this type of context, you must also allocate a M_SHAPE_CIRCLE Model Finder result buffer.

(summarize)
ControlFlag

Reserved for future expansion. This parameter must be set to M_DEFAULT.

ContextIdPtr

Specifies the address of the variable in which to write the Model Finder context identifier. Since the MmodAlloc() function also returns the Model Finder context identifier, you can set this parameter to M_NULL.

Return value
The returned value is the Model Finder context identifier if the allocation is successful. If allocation fails, M_NULL is returned.
Compilation information
Header Include mil.h.
Library Use mil.lib; milmod.lib.
DLL Requires mil.dll; milmod.dll.
DEFAULT HOST GEOMETRIC GEOMETRIC CONTROLLED SHAPE CIRCLE