MIL_ID ContextPatId, | //in |
MIL_INT64 ModelType, | //in |
MIL_ID SrcImageBufId, | //in |
MIL_DOUBLE Param1, | //in |
MIL_DOUBLE Param2, | //in |
MIL_DOUBLE Param3, | //in |
MIL_DOUBLE Param4, | //in |
MIL_INT64 ControlFlag | //in |
This function allows you to add one or more models at a time to, or delete a model from, a Pattern Matching context. When defining a search model, you are specifying the area of an image to use as a pattern to find within a target image, using MpatFind(). When a call to MpatFind() is made, all models that are part of the specified context (and that have MpatControl() with M_NUMBER set to a value greater than zero) are searched for simultaneously in the target. Note, when a model is added or deleted, the Pattern Matching context must be preprocessed again, using MpatPreprocess().
The search is performed according to the general search settings specified in the Pattern Matching context, as well as the individual model search settings (depending on the M_SEARCH_MODE value specified). Specify both the context and individual model search settings using MpatControl().
When adding a model to the context, a number is assigned to the new model. The context starts numbering the models at 0, and each subsequent model added to the Pattern Matching context is given a sequential index number, in the order that you add the models. When deleting a model, all models with a higher index shift down one.
Specifies the Pattern Matching context to which to add, or from which to delete, the model. The Pattern Matching context must have been previously allocated on the required system using MpatAlloc().
Specifies the type of the model to define when adding models to the context, or specifies to delete a model from the Pattern Matching context.
See the Parameter associations section for possible values that can be specified.
Specifies the identifier of the image buffer from which to define the models, or the Pattern Matching context from which to copy a model.
Set this parameter to M_NULL if not used.
See the Parameter associations section for possible values that can be specified.
Specifies an attribute of the model to add. Its definition is dependent on the model type chosen. When not used, set this parameter to M_DEFAULT.
See the Parameter associations section for possible values that can be specified.
Specifies an attribute of the model to add. Its definition is dependent on the model type chosen. When not used, set this parameter to M_DEFAULT.
See the Parameter associations section for possible values that can be specified.
Specifies an attribute of the model to add. Its definition is dependent on the model type chosen. When not used, set this parameter to M_DEFAULT.
See the Parameter associations section for possible values that can be specified.
Specifies an attribute of the model to add. Its definition is dependent on the model type chosen. When not used, set this parameter to M_DEFAULT.
See the Parameter associations section for possible values that can be specified.
Specifies the speed of the allocation or the interpolation mode to use, depending on the model type chosen. When not used, set this parameter to M_DEFAULT.
See the Parameter associations section for possible values that can be specified.
The tables below list possible values for the ModelType, SrcImageBufId, Param1, Param2, Param3, Param4, and ControlFlag parameters.
To add a model to the Pattern Matching context, the ModelType, Param1, Param2, Param3, and ControlFlag parameters can be set to the following values:
Note that any unused parameters should be set to M_DEFAULT. Note, if unused, set SrcImageBufId to M_NULL.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
SrcImageBufId | |||||||||||||||||||||||||||||||||||||||
Param1 | |||||||||||||||||||||||||||||||||||||||
Param2 | |||||||||||||||||||||||||||||||||||||||
Param3 | |||||||||||||||||||||||||||||||||||||||
Param4 | |||||||||||||||||||||||||||||||||||||||
ControlFlag | |||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Defines one or more models automatically of the specified dimensions from the most-suitable distinct areas found, in the source image. If none are found, no model is allocated and an error is reported. This is useful when you want to perform whole image alignment, for which allocation of a distinct model is essential. It can take several seconds to find the best models (more for large or small images). To be effective, the source image should be a typical target image. You can only define an M_AUTO_MODEL that respect the following condition: (maxvalue 2 * Param3 * Param4) < 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 model must be greater or equal to 4 pixels (Param3 * Param4 >= 4). (summarize)Defines one or more models automatically of the specified dimensions from the most-suitable distinct areas found, in the source image. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Sets the identifier of the image buffer (source image) from which to extract a distinct model. The image buffer must be a 1-band, 8-bit, unsigned processing buffer. 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. (summarize)Sets the identifier of the image buffer (source image) from which to extract a distinct model. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Sets the maximum displacement (shift), in the horizontal direction, expected between the position of the model in the source image and the position of the model when found in the target image. This information is used to select models that are far enough from the image borders to be present in the target images. (summarize)Sets the maximum displacement (shift), in the horizontal direction, expected between the position of the model in the source image and the position of the model when found in the target image. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Selects models from anywhere in the whole width of the image. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the expected maximum pixel displacement in the horizontal direction, as an integer. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Sets the maximum displacement (shift), in the vertical direction, expected between the position of the model in the source image and the position of the model when found in the target image. This information is used to select models that are far enough from the image borders to be present in the target images. (summarize)Sets the maximum displacement (shift), in the vertical direction, expected between the position of the model in the source image and the position of the model when found in the target image. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Selects models from anywhere in the whole height of the image. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the expected maximum pixel displacement in the vertical direction, as an integer. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Sets the width of the model, as an integer. Note that the width of the model must be equal to or smaller than the width of your source image. (summarize)Sets the width of the model, as an integer. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Sets the height of the model, as an integer. Note that the height of the model must be equal to or smaller than the height of your source image. (summarize)Sets the height of the model, as an integer. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Sets the speed of the process by which model(s) are defined from the model source image. (summarize)Sets the speed of the process by which model(s) are defined from the model source image. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Same as M_FAST. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies that the search should favor high precision over speed. You should typically use this setting if the model source image is small. (summarize)Specifies that the search should favor high precision over speed. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies that the search should favor speed over high precision. You should typically use this setting if your model source image is large. (summarize)Specifies that the search should favor speed over high precision. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Defines a regular model, from the specified area, in the source image. You can use this type of model when dealing with images containing a mix of models on an inconsistent background, such as an image of loose nuts and bolts lying on a metal sheet. If the occurrence can appear at an angle, specify the angular range in which it can appear, using MpatControl() with M_SEARCH_ANGLE.... If the occurrence is expected to be found always with the same background, use the M_CIRCULAR_OVERSCAN combination constant. You can only define an M_REGULAR_MODEL that respect the following condition: (maxvalue 2 * Param3 * Param4) < 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 model must be greater or equal to 4 pixels (Param3 * Param4 >= 4). (summarize)Defines a regular model, from the specified area, in the source image. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Sets the identifier of the image buffer (model source image) from which to extract the model. The image buffer must be a 1-band, 8-bit, unsigned processing buffer. 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. You can specify an image buffer (source image) that is associated to an ROI that was set using a rotated rectangle in a 2D graphics list. To add a rotated rectangle to a 2D graphics list, you can call MgraRectAngle(); to set (associate) that rectangle as the ROI of an image buffer, you can call MbufSetRegion() with M_RASTERIZE or M_NO_RASTERIZE and M_FILL_REGION. If the region is a non-rectangular shape, you will get an error. When specifying an image buffer (source image) that is associated to an ROI, you must set Param2, Param3, and Param4, to M_DEFAULT. (summarize)Sets the identifier of the image buffer (model source image) from which to extract the model. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the X-coordinate of the top-left corner of the model (origin) in the model source image (SrcImageBufId). Note that this X-coordinate must not be outside the model source image. (summarize)Specifies the X-coordinate of the top-left corner of the model (origin) in the model source image (SrcImageBufId). (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies that the X-coordinate of the model origin is 0. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the X-coordinate of model origin in the source image, in pixels (as an integer). |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the Y-coordinate of the top-left corner of the model (origin) in the source image (SrcImageBufId). Note that this Y-coordinate must not be outside the model source image. (summarize)Specifies the Y-coordinate of the top-left corner of the model (origin) in the source image (SrcImageBufId). (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies that the Y-coordinate of the model origin is 0. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the Y-coordinate of model origin in the source image, in pixels (as an integer). |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the width of the model in the model source image. Note that the region from which the model is defined must not be outside the model source image. (summarize)Specifies the width of the model in the model source image. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies that the width of the model is the distance from the origin of the model to the edge of the image in the X-direction. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the width of the model in the model source image, in pixels (as an integer). |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the height of the model in the model source image. Note that the region from which the model is defined must not be outside the model source image. (summarize)Specifies the height of the model in the model source image. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies that the height of the model is the distance from the origin of the model to the edge of the image in the Y-direction. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the height of the model in the model source image, in pixels (as an integer). |
You can add the following value to the above-mentioned values to extract the model as well as a circular area around it.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies that the model is extracted from the source image with the circular overscan data. The circular overscan data is determined by rotating the model, about its center. The circular overscan data of an M_CIRCULAR_OVERSCAN type model is used if you search for an occurrence of the model at an angle. Angular search is fastest when performed with an M_CIRCULAR_OVERSCAN model; however, M_CIRCULAR_OVERSCAN should only be used when the region around the model is consistent, for example, when searching for a chip in the image of an integrated circuit. When preprocessing an M_CIRCULAR_OVERSCAN model for which an angular search range has been specified, a set of models is extracted from rotated versions of the M_CIRCULAR_OVERSCAN model, defining models that would appear upright if the target image were rotated. For this type of model, a larger region than the one defined is extracted from the source image so as to allow creation of models at different angles. The model must not be extracted from a region too close to the edge of the source image. In addition, the M_CIRCULAR_OVERSCAN model should be complex enough so that if models are created from it at the required angles, they are representative of the pattern being sought. For a model defined to include circular overscan data, you cannot define "don't care" regions (MpatMask()). (summarize)Specifies that the model is extracted from the source image with the circular overscan data. (more details...) |
You can add the following value to the above-mentioned values to set the number of models to allocate from the same image.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Allocates several models from the same source image. Set n to the number of models to define. For example, set ControlFlag to M_BEST + M_MULTIPLE + 4 to define the four most distinct models available in your model source image. Search models can overlap within the image by half the size of the model (in X and Y). (summarize)Allocates several models from the same source image. (more details...) |
When deleting a model from the specified Pattern Matching context, use the following value:
Any unused parameters should be set to M_DEFAULT. Note, if unused, set SrcImageBufId to M_NULL.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description | ||||||||||||||||||||||||||||||||||||||
SrcImageBufId | |||||||||||||||||||||||||||||||||||||||
Param1 | |||||||||||||||||||||||||||||||||||||||
Param2 | |||||||||||||||||||||||||||||||||||||||
Param3 | |||||||||||||||||||||||||||||||||||||||
Param4 | |||||||||||||||||||||||||||||||||||||||
ControlFlag | |||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to remove the specified model from the Pattern Matching context, specified using the Param1 parameter. When deleting a model, all models with a higher index shift down one. (summarize)Specifies to remove the specified model from the Pattern Matching context, specified using the Param1 parameter. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
This parameter must be set to M_NULL. (summarize)This parameter must be set to M_NULL. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the model to delete from within the Pattern Matching context. (summarize)Specifies the model to delete from within the Pattern Matching context. (more details...) |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to delete all models from the Pattern Matching context. |
||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies the index of the model to delete. |
Header | Include mil.h. |
Library | Use mil.lib; milpat.lib. |
DLL | Requires mil.dll; milpat.dll. |