| MIL 10 Reference
| Customize Help
| Save Settings

MpatFindModel



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
Synopsis
Find a pattern matching model in the target image buffer.
Syntax
void MpatFindModel(
MIL_ID ImageBufId, //in
MIL_ID ModelId, //in
MIL_ID PatResultId //in
)
Description

This function finds occurrences of the specified model in the given image and returns the position of each occurrence. The search is performed using the model's current search parameters. Note, this function assumes that the model has been preprocessed (MpatPreprocModel()).

You can limit the operation to a region of the image buffer, using a rectangular region of interest (ROI) set using MbufSetRegion(). Doing so will cause an increase in processing time, but it is more flexible than setting a search region using MpatSetPosition() because it allows a search at an angle and it is possible to define your search region in world units.

This function assumes that the model was extracted from a source image with the same scaling as the target image. In addition, if using a normalized grayscale non-rotational model, it assumes that the source image and the model's target image are of the same orientation (with approx. 5° tolerance). For angular search, use MpatSetAngle() to set the angular search range of the model.

The model's search parameters specify the maximum number of occurrences for which to look in the target image (MpatSetNumber()).

If a correlation has a match score greater than or equal to the certainty level (MpatSetCertainty()), it is automatically considered an occurrence (default 80%). The remaining occurrences will be the best of those greater than or equal to the acceptance level (MpatSetAcceptance()).

Results are written to the specified result buffer. Use the MpatGet...() functions to read the results. See MpatAllocResult() for more information on allocating result buffers.

This function returns results in decreasing match-score order. This means that the most-likely occurrence is always returned first.

Patterns that are very close to the edge of the image might be found with lower match scores than usual due to edge effects. For this reason, you should use an ROI set using MbufSetRegion() or a search region set using MpatSetPosition(), rather than a child buffer, to restrict the search to a portion of the image.

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
ImageBufId

Specifies the identifier of the target image. Note that this function only supports 8-bit unsigned grayscale images.

This image buffer can only have a rectangular region of interest (ROI) defined (with or without rotation). Besides defining the region in which to search, the angle of the ROI is used as the nominal search angle. In addition, the region must be defined in vector format from a graphics list (M_VECTOR or M_VECTOR_AND_RASTER). An error will be generated if the ROI is only in raster format (M_RASTER) or a non-rectangular shape. An error will be generated if M_SEARCH_ANGLE is set to a value other than 0.0 when the image buffer has an ROI.

ModelId

Specifies the identifier of the model for which to search in the specified target image buffer.

PatResultId

Specifies the identifier of the pattern matching result buffer in which to store results.

Compilation information
Header Include mil.h.
Library Use mil.lib; milpat.lib.
DLL Requires mil.dll; milpat.dll.
UNSIGNED PROC RASTER