| Customize Help

Position, angle, and scale



You can control the position, angle, and scale at which Model Finder searches for each model in a target.

You can restrict the position, angle, and scale at which model occurrences can be found, to an expected (nominal) position, angle, or scale or to a given range.

Enabling calculations specific to searching within a range

Depending on whether searching for models within a range of positions, angles, and/or scales, Model Finder typically uses different search strategies to evaluate the edge-based features of the target candidates. Typically, to search for models within a range, calculations specific to the corresponding search strategy should be enabled for the context (MmodControl() with M_SEARCH_POSITION_RANGE, M_SEARCH_ANGLE_RANGE, and/or M_SEARCH_SCALE_RANGE). If you expect that the occurrences sought are close to the specified nominal position, angle, or scale (for example, in a registration application), you can try disabling the calculations specific to the corresponding search strategies to see if Model Finder can still find the required occurrences. Disabling one or more of these calculations might speed up the search depending on the model and the target.

These control types are not supported for M_SHAPE_... type of Model Finder contexts because these search strategies are natively supported.

Note that candidates can only be returned as results if found within the ranges specified for their model. Therefore, if you have disabled calculations specific to a search strategy and occurrences at positions, angles, and/or scales outside of a required range are being returned, you can restrict which candidates are returned as occurrences by narrowing the appropriate ranges. Furthermore, the various search ranges can still be set even if the calculation specific to the corresponding search strategy has been disabled. This is due to the fact that at the end of the matching process, MIL performs a best fit match for finer accuracy. This final fit process can introduce model translations (rotation, position-shifting, scaling) relative to the expected occurrence. Once potential candidates have been identified, the final fit process will look for the best model within the specified ranges. Therefore, it is possible to restrict this final fit process to a smaller range than normally allowed, by explicitly setting the accepted range for identified candidates.

Search position and position range

You can search for each model defined in a Model Finder context at a specific position or within a position range. The position range limits the region in which the position of a model occurrence can be found; position coordinates which fall outside this region cannot be returned as results (MmodGetResult() with M_POSITION_X and M_POSITION_Y). Note that the position returned for an occurrence is determined by the model's reference axis origin; by default, this position is set to the center of the model; however, it can be displaced if necessary (see the Reference axis subsection of the Customizing search settings section later in this chapter).

The default position range is the entire image plane (M_INFINITE) in the positive X- and Y-direction, meaning that all X- and Y-coordinates in the positive direction (even outside the target if applicable) can be returned as results. You can use the MmodControl() M_POSITION_DELTA_NEG_X, M_POSITION_DELTA_NEG_Y, M_POSITION_DELTA_POS_X, and M_POSITION_DELTA_POS_Y control types to set the position range relative to the nominal position. Alternatively, you can define a search position region using a rectangle drawn in a 2D graphics list by allocating a 2D graphics list, defining a rectangle within this 2D graphics list, and then using MmodControl() with M_SEARCH_POSITION_FROM_GRAPHIC_LIST. You can, if necessary, set a different position range for each model in your context.

Depending on the number of details present in the target, using a small position range generally decreases the search time. Always set the position range to the minimum required when speed is a consideration; M_POSITION_DELTA_NEG_X, M_POSITION_DELTA_NEG_Y, M_POSITION_DELTA_POS_X, and M_POSITION_DELTA_POS_Y can be greater or equal to zero. If they are all set to zero, the occurrence must be at the position specified by the nominal position.

Note that you can specify a position range which defines a region partially, or totally, outside of the target; this might be necessary, depending on the reference axis origin of the model.

By default, for an M_GEOMETRIC or M_GEOMETRIC_CONTROLLED type of Model Finder context, calculations specific to position-range search strategies are enabled but can be disabled (see the Enabling calculations specific to searching within a range subsection of this section). If you are searching for a single occurrence of each model in your context and you know the nominal position of each (for example, registration applications), you can disable the calculations specific to position-range search strategies for the context, using MmodControl() with M_SEARCH_POSITION_RANGE set to M_DISABLE. When disabled, you must specify a good nominal position for each model (using MmodControl() with M_POSITION_X and M_POSITION_Y). You can restrict which candidates are returned as occurrences by narrowing the position-range.

For an M_SHAPE_... type of Model Finder context, calculations specific to position-range search strategies are not necessary; as such, M_SEARCH_POSITION_RANGE is not supported.

Angle and angular range

You can search for each model defined in a Model Finder context at a specific angle or within an angular range. For each model in your context, you can specify the angle of the search, using MmodControl() with M_ANGLE. By default, the search angle is 0°.

You can also search within the full angular range of 360° from the nominal angle specified with M_ANGLE. Use the MmodControl() M_ANGLE_DELTA_POS and M_ANGLE_DELTA_NEG control types to specify the angular range in the counter-clockwise and clockwise direction from the nominal angle, respectively; the default for both is 180°. The angular range limits the possible angles which can be returned as results for an occurrence. Note that for general geometric contexts, the actual angle of the occurrence does not affect search speed. If you need to search for a model at discrete angles only (for example, at intervals of 90 degrees), it is typically more efficient to allocate a controlled geometric context, and define several models with different expected angles, than to search through the full angular range.

For a model in an M_SHAPE_RECTANGLE or M_SHAPE_SEGMENT Model Finder context, there are additional control types related to angle to control the segment and rectangle found; see the Angle for rectangles and segments subsection of the Search settings specific to models in specialized shape contexts section later in this chapter.

By default, for an M_GEOMETRIC or M_GEOMETRIC_CONTROLLED type of Model Finder context, calculations specific to angular-range search strategies are enabled but can be disabled (see the Enabling calculations specific to searching within a range subsection of this section). If you expect that the occurrences sought are close to the specified nominal angle, you can disable the angular calculations using MmodControl() with M_SEARCH_ANGLE_RANGE set to M_DISABLE. When disabled, you must specify a good nominal angle for each model, which is within the model's angular range. You can restrict which candidates are returned as occurrences by narrowing the angular-range.

Note that M_SEARCH_ANGLE_RANGE must be enabled to search for a rotation-invariant non-synthetic model (for example, an image-type model of a circle).

For an M_SHAPE_... type of Model Finder context, calculations specific to angle-range search strategies are not necessary; as such, M_SEARCH_ANGLE_RANGE is not supported.

Scale and scale range

The scale of the model establishes the size of the occurrence that you expect to find in the target. If the expected occurrence is smaller or larger than that of the model, you can set the nominal scale of the occurrence for each individual model, using MmodControl() with M_SCALE. The supported scale factors are 0.5 to 2.0 for models in an M_GEOMETRIC or M_GEOMETRIC_CONTROLLED type of Model Finder context. For models in an M_SHAPE_... type of Model Finder context, the nominal scale can be any positive value.

When the scale of occurrences can vary around the specified nominal scale, you can enable calculations specific to scale-range search strategies for the context using MmodControl() with M_SEARCH_SCALE_RANGE set to M_ENABLE. To specify the range of scales, use MmodControl() with M_SCALE_MAX_FACTOR and M_SCALE_MIN_FACTOR. The minimum factor and the maximum factor together determine the scale range from the nominal scale (M_SCALE).

The maximum and minimum factors are applied to the M_SCALE setting as follows:

Maximum scale = (M_SCALE) x (M_SCALE_MAX_FACTOR)

Minimum scale = (M_SCALE) x (M_SCALE_MIN_FACTOR)

Note that the range is defined as factors so that if you change the expected scale (M_SCALE), you do not have to modify the range. A search through a range of scales is performed in parallel, meaning that the actual scale of an occurrence has no bearing on which occurrence will be found first.

By default, for an M_GEOMETRIC type of Model Finder context, calculations specific to scale-range search strategies are disabled but can be enabled (see the Enabling calculations specific to searching within a range subsection of this section). When disabled, you must specify a good nominal scale for each model, which is within the model's scale range. Note that occurrences can still be found within the scale range specified for their model. You can restrict which candidates are returned as occurrences by narrowing the scale-range. When calculations specific to scale-range search strategies are enabled, the scale range should be used to cover an expected variance in the scale; you should not use the scale range to cover different expected scales at different positions. In this case, it is typically more efficient to define several models with different expected scales. This is because a large scale range could potentially slow down your operation; as well, you could find unwanted occurrences.

For models in an M_GEOMETRIC_CONTROLLED type of Model Finder context, scale-range searches are not supported, so you cannot enable M_SEARCH_SCALE_RANGE. However, you can still use M_SCALE_MAX_FACTOR and M_SCALE_MIN_FACTOR to restrict the results that are returned.

For an M_SHAPE_... type of Model Finder context, calculations specific to scale-range search strategies are not necessary because scale-range is natively supported; as such, M_SEARCH_SCALE_RANGE is not supported.