| Customize Help
| Save Settings

MmodAlloc



Function Map
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().

Define and add models to the Model Finder context using MmodDefine(). You must add at least one model to the context regardless of the context type. Some context types accept only one model.

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 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
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
Click to summarizeValue Description
Click to summarize M_DEFAULT_HOST

Specifies the default Host system of the current MIL application.

Click to summarize 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
Click to summarizeValue Description
Click to summarize 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)
Click to summarize M_GEOMETRIC_CONTROLLED

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

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, although searching within an angular range is supported.

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); searching through a range of scales is not supported (M_SEARCH_SCALE_RANGE is disabled by default and cannot be set to M_ENABLE).

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)
Click to summarize 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. If the target is associated with a camera calibration context, the model will be interpreted in world units; conversely, if the target does not have a camera calibration context associated with it, the model will be interpreted in pixel units.

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 controllable deformation tolerance (M_SAGITTA_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, M_SEARCH_POSITION_RANGE, and M_SEARCH_SCALE_RANGE are turned off by default and cannot be set to M_ENABLE.

When using this type of context, you must also allocate an M_SHAPE_CIRCLE Model Finder result buffer.

(summarize)
Click to summarize M_SHAPE_ELLIPSE

Specifies that the Model Finder context uses an elliptical model search algorithm.

This context only supports M_ELLIPSE type models, and only supports one model per context. The model cannot be calibrated. If the target is associated with a camera calibration context, the model will be interpreted in world units; conversely, if the target does not have a camera calibration context associated with it, the model will be interpreted in pixel units.

This search algorithm is recommended when the objects being sought are elliptical-type shapes (it can also find circles). Besides controllable deformation tolerance (M_SAGITTA_TOLERANCE), it allows finding ellipses at varying aspect ratios (M_MODEL_ASPECT_RATIO and M_MODEL_ASPECT_RATIO_..._FACTOR).

When using this type of Model Finder context, M_SEARCH_ANGLE_RANGE, M_SEARCH_POSITION_RANGE, and M_SEARCH_SCALE_RANGE are turned off by default and cannot be set to M_ENABLE.

When using this type of context, you must also allocate an M_SHAPE_ELLIPSE Model Finder result buffer.

(summarize)
Click to summarize M_SHAPE_RECTANGLE

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

This context only supports M_RECTANGLE type models, and only supports one model per context. The model cannot be calibrated. If the target is associated with a camera calibration context, the model will be interpreted in world units; conversely, if the target does not have a camera calibration context associated with it, the model will be interpreted in pixel units.

This search algorithm is recommended when the objects being sought are rectangular-type shapes (it can also find squares). Besides controllable deformation tolerance (M_DEVIATION_TOLERANCE), it allows finding rectangles at varying aspect ratios. However, at least a portion of each of their sides must be visible; that is, the model coverage on any side cannot be 0 (M_MIN_SIDE_COVERAGE).

When using this type of context, you must also allocate an M_SHAPE_RECTANGLE Model Finder result buffer.

(summarize)
Click to summarize M_SHAPE_SEGMENT

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

This context only supports M_SEGMENT type models, and only supports one model per context. The model cannot be calibrated. If the target is associated with a camera calibration context, the model will be interpreted in world units; conversely, if the target does not have a camera calibration context associated with it, the model will be interpreted in pixel units.

This search algorithm is recommended when the objects being sought are segment-type shapes. Besides controllable deformation tolerance (M_DEVIATION_TOLERANCE), it allows finding segments lying on contours.

When using this type of context, you must also allocate an M_SHAPE_SEGMENT 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 SHAPE ELLIPSE SHAPE RECTANGLE SHAPE SEGMENT