Pattern Matching

NI Vision Assistant

Pattern Matching

Performs template matching on grayscale images using Pattern Matching.

Main Tab

The following controls are available on the Main tab.

  • Step Name—Name to give the step.
  • Reposition Region of Interest—When enabled, the step dynamically repositions the region of interest based on a coordinate system you built in a previous step.
  • Reference Coordinate System—Coordinate system to which you want to link the region of interest.

Template Tab

The following controls are available on the Template tab.

  • Template Image—Image you want to search for in an inspection image.
  • Template Size—The width and height, in pixels, of the selected template image.
  • Match Offset—Specifies the number of pixels you want to shift the focal point of the template from the center of the template. The focal point of the template is the coordinate location of the template match within an inspection image.
  • New Template—Launches the NI Vision Template Editor wizard, in which you can learn a template and save the result as a template image file.
  • Edit Template—Launches the NI Vision Template Editor wizard, in which you can modify a template and save the result as a template image file.
  • Load from File—Launches a dialog box in which you can browse to a template image file and specify that file as the search template.
    Note  When you load a template from file, the template can be any valid NI Vision template file, such as a golden template. The Pattern Matching step prompts you to add pattern matching information to the file.
  • Template Path—Displays the location of the template image file.

Settings Tab

The following controls are available on the Settings tab.

  • Number of Matches to Find—Specifies the number of valid matches you expect the pattern matching function to return.
  • Minimum Score—Specifies the minimum score an instance of the template can have to be considered a valid match. This value can range from 0 to 1000, where a score of 1000 indicates a perfect match.
  • Subpixel Accuracy—When enabled, returns the match with subpixel accuracy.
  • Search for Rotated Patterns—When selected, searches for the template in an image regardless of rotation and shift of the template. When unselected, this option searches for the image regardless of shifting along the x-axis and y-axis.
  • Angle Range—Angles at which you want to search for the template image. The function searches for the template image at angles ranging from the positive angle to the negative angle.
  • Mirror Angle—When enabled, the function searches for the template image in the angle range, which you specified in Angle Range, and in the mirror of that angle range.

Results

Displays the following information after searching the image for the template:

  • Center X—X-coordinate of each object that matches the template.
  • Center Y—Y-coordinate of each object that matches the template.
  • Score—Score of each valid match. Score values can range from 0 to 1000, where a score of 1000 indicates a perfect match.
  • Angle—Rotation angle of each object that matches the template at the current match location. Angles are expressed in degrees. This output is valid only when you select rotation-invariant matching.