Collapse
CollapsingX
  • - or -

PatternMatching step advanced settings


Matrox Design Assistant provides several parameters you can adjust to get the required result. For each individual model, you can:

  • Optimize your search by stopping the operation as soon as a candidate whose score is above the Certainty level is found.

  • Select the Speed and Accuracy of the search operation. A higher speed setting can be used with clean, high-contrast images. A lower accuracy can speed up the search.

  • The Reference Point X and Reference Point Y properties indicate the point on the model whose match position will be returned. The point can also be changed by clicking on the cross-shaped toolbar button in the Configuration pane and clicking in the model image. The reference point can also be located outside the model by specifying its coordinates in the Configuration pane.

Note, if you are using pattern matching to link to a metrology frame, it is best to position the reference point where you want the frame to appear - for example at the corner or center of the part to be inspected.

To apply the same setting to multiple models at once, use the Apply multiple dialog, accessible from the setting's Alternate options button.

Defining a mask region

If you expect a portion of the source model to be significantly different in the target image, for example different text on a label or different patterns in the background, you can define a mask to create a "don't care" region. To do so, you can use the Pencil, Rectangle, and Eraser toolbar buttons to create or modify the mask.

Use the Pencil to create a region using a brush. The Rectangle will draw a mask with a rectangular shape. The 2 Erasers can be used to erase a part of the mask or to clear the current mask.

Note that mask regions are not supported for circular overscan models.

Specify an angular range

If you expect the model to appear at different angles in the target image, you can enable SearchAngle. To do so, the following values can be adjusted:

  1. The nominal Angle property set the expected angle of the model in the target image.

  2. The DeltaNegative and DeltaPositive properties set the range over which to search for the model with respect to the Angle property.

  3. When searching for the model over the specified range, step sizes of Tolerance degrees are used.

  4. Optionally, the search for the best candidate can be further refined by using step sizes of Accuracy degrees.

  5. You can also specify whether to use Bicubic, Bilinear or NearestNeighbor interpolation when rotating the model.

The time taken to search and the memory taken by the model increase proportionally by the following factor:

To optimize performance, it is recommended that you reduce DeltaPositive and DeltaPositive, reduce the size of the model, or increase Tolerance. If you need high range, low tolerance, accurate searches (for example steps of 1° for 360º), consider using the ModelFinder step. The ModelFinder step does not require more resources when SearchAngle is enabled.

Summary of algorithm for angle search

The match score represents the percentage of pixels that are the same. The Certainty level is for definite matches and its default value is 80%. A match score that falls between the Acceptance level and the Certainty level can be considered as a possible occurrence. More information can be found in this section.

The following is a decision tree that summarizes the general behavior of the algorithm:

If SearchAngle is enabled, the search starts at the nominal Angle and proceeds successively farther away in both directions (by alternating addition/subtraction of the Tolerance to the current angle). In Normal mode, the algorithm returns the angle of the first match. With circular overscan models, a fine/coarse angle search is implemented and the angle of the best candidate is returned.

Since the algorithm is optimized for speed, as implied above, by default, the algorithm searches for the first occurrence above Certainty and, if successful, will exit the search loop. This optimization for speed, therefore, might not return the best match. For more precise angle determination, the ModelFinder step and Measurement modules are recommended. Alternatively, use the PatternMatching module on 2 smaller models at opposite ends of the object and determine the angle between them; it will not be sensitive to small angle errors in the individual matches.

Setting the Search Levels

The PatternMatching step search algorithm will identify numerous match candidates for the model using a subsampled, reduced-size image. It then progressively refines the search around the best candidates at increasing levels of detail. Set the Search levels properties to override the default progression.

By default (when FirstLevel is set to Default or AutoSizeBased), Search Level parameters are automatically adapted to the size of the model and of the search region. They control the size and number of scaled down images that are used in the preliminary stages of the search. Level 0 is the full size model and image, level 1 is half-size, level 2 is quarter-size, and so on. When FirstLevel is set to AutoContentBased, the parameter is based on an analysis of the model contents.

If you are more interested in the presence of an object rather than its precise location, you might be able to skip the highest resolution search by raising the LastLevel.

Setting a Master model

If you have multiple models with the same size and which can use the same search parameters, then you can optimize your search by setting Uniform size to True. This allows you to specify a Master model and all the model specific settings will be taken from that model. The Number property of the Master model is used to determine the total number of occurrences to search for.

Search using the SpecificSearch mode

If you have created many models, but are only required to search for some of them (instead of searching for all of them at once), you can search for a list of specific models using the SpecificSearch mode. SpecificSearch mode (whose properties are available in the Properties pane only) allows you to type in a text string of the names of the models to be found.

To search for specific models, perform the following:

  1. Set the SearchSpecificModels property to True.

  2. Specify the ModelsToSearch. Enter a text string of the names of the models to be found, separated by a semicolon (;), with no extra spaces.