MIL_ID SystemId, | //in |
MIL_ID SrcImageBufId, | //in |
MIL_INT SizeX, | //in |
MIL_INT SizeY, | //in |
MIL_INT PosUncertaintyX, | //in |
MIL_INT PosUncertaintyY, | //in |
MIL_INT64 ModelType, | //in |
MIL_INT64 Mode, | //in |
MIL_ID *ModelIdArrayPtr | //out |
This function searches for the specified number of most-suitable unique areas, of the specified dimensions, in the model's source image. From each area found, the function automatically allocates a model. If none are found, no model is allocated and an error is reported. It can take several seconds to find the best models (more for large or small images).
To be effective, the model's target image should be a typical target image. Therefore, MpatAllocAutoModel() is useful, for example, when you want to perform whole image alignment, for which allocation of a unique model is essential.
You can determine the offset of a model's origin relative to its source image, using the MpatInquire() function.
If the eventual model can appear at an angle, in most cases, it is better to allocate an M_NORMALIZED + M_CIRCULAR_OVERSCAN type of model and then use MpatSetAngle() to specify the angular range.
You can change a model's search parameter settings at any time, using the appropriate MpatSet...() function. When the model(s) is no longer required, you should release its memory, using MpatFree().
You can only define models that respect the following condition: (maxvalue 2 * SizeX * SizeY) < 2 63 where maxvalue is the maximum pixel value (typically, 255) in the target image and the model. This restriction is imposed to avoid overflows in the internal 64-bit accumulators.
The total area of the defined model must be greater or equal to 4 pixels (SizeX * SizeY >= 4).
Specifies the system on which to allocate the models.
This parameter should be set to one of the following values:
For specifying the system
identifier
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT_HOST |
Specifies the default Host system of the current MIL application. |
||||||||||||||||||||||||||||||||||||||
MIL system identifier |
Specifies a valid system identifier, which you have allocated using the MsysAlloc() function. |
Specifies the identifier of the image buffer from which to extract the models. This image should be representative of the target images. This function currently supports only 8-bit unsigned grayscale images.
This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.
Specifies the maximum displacement (shift) expected between the reference position of the models in the source image and their position when found in the target images in the horizontal direction. This information is used to select models that are far enough from the image borders to be present in the target images.
This parameter must be set to one of the values below.
For specifying the maximum displacement
in the X-direction
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Selects models from anywhere in the whole width of the image. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Sets PosUncertaintyX to the expected maximum pixel displacement in the horizontal direction. (more details...) |
Specifies the maximum displacement (shift) expected between the reference position of the models in the source image and their position when found in the target images in the vertical direction. This information is used to select models that are far enough from the image borders to be present in the target images.
This parameter must be set to one of the values below.
For specifying the maximum displacement
in the Y-direction
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Selects models from anywhere in the whole height of the image. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Sets PosUncertaintyY to the expected maximum pixel displacement in the vertical direction. (more details...) |
Specifies the type of the model. The parameter must be set to the following:
For specifying the type of
model
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_NORMALIZED + |
Specifies a model used to search for the position, match score, and angle (if angular search is enabled) of a model occurrence in a target image, using MpatFindModel() and MpatFindMultipleModel(). |
You can add the following value to the above-mentioned value to extract the model, as well as circular overscan data.
For the ModelType parameter
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
||||||||||||||||||||||||||||||||||||||
M_CIRCULAR_OVERSCAN |
Extracts the model, as well as circular overscan data from the source image. (more details...) |
Specifies the speed of the allocation process. This parameter must be set to one of the values below.
For specifying the speed of the
allocation
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Same as M_FAST. |
||||||||||||||||||||||||||||||||||||||
M_BEST + |
Allocates the models with high precision. |
||||||||||||||||||||||||||||||||||||||
M_FAST + |
Allocates the models at high-speed. |
You can add the following value to the above-mentioned values to set the number of models to allocate from the same image.
For the Mode parameter
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
||||||||||||||||||||||||||||||||||||||
M_MULTIPLE + n |
Allocates several models from the same image. (more details...) |
Specifies the address of the array in which to write the model identifiers. The identifier is required to use a model with other pattern matching functions. Since MpatAllocAutoModel() also returns the model identifier, you can set this parameter to M_NULL when allocating a single model. If allocation fails, M_NULL is written as the identifier.
Header | Include mil.h. |
Library | Use mil.lib; milpat.lib. |
DLL | Requires mil.dll; milpat.dll. |