Set the pattern matching search position.


void MpatSetPosition(ModelId, OffX, OffY, SizeX, SizeY)

MIL_ID ModelId;

Identifier of model to be affected

long OffX;

X-coordinate of search region origin within target image

long OffY;

Y-coordinate of search region origin within target image

long SizeX;

Width of search region

long SizeY;

Height of the search region


This function sets the specified model’s search parameters for the search region position. It limits the area in the target image in which to find the reference point of the model (set with MpatSetCenter), and consequently increases the search speed. This function is useful when the model center is expected to be found in a certain area. You can change the search area at any time (for example, when tracking an object, the search region could be changed before each call to MpatFindModel or MpatFindMultipleModel).

Always use this function, rather than a child buffer, to restrict the search area. Other methods result in edge effects, and if the search area is as small as or smaller than the model, they produce invalid results.

The ModelId parameter specifies the identifier of the model for which to change the search position parameter.

The OffX and OffY parameters specify the coordinates of the top-left corner of the search region in the target image.

The SizeX and SizeY parameters specify the width and height of search region. Note, it is valid to specify a search area that is smaller than the search model since you are setting the area in which to find the model center.

To change some of this function’s parameters without affecting others, specify M_NO_CHANGE for those you do not want to change. To reset the search region size to the full image, set OffX and OffY to zero (0), and SizeX and SizeY to M_ALL.