Color Pattern Matching

NI Vision Assistant

Color Pattern Matching

Searches for color templates in color images using Color 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—The image to use as the template.
  • Template Size—Specifies the dimensions of the template.
    • Width—Width of the template in pixels.
    • Height—Height of the template in pixels.
  • Create Template—Learns the selected ROI and saves it as a template image file. Specifies that file as the template to search for.
  • 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.
  • Ignore Black and White—Specifies the pixels to ignore during the matching phase.
    • Disabled—Specifies that black and white pixels are not ignored during the matching phase.
    • Ignore Black—Specifies that black pixels are ignored during the matching phase.
    • Ignore White—Specifies that white pixels are ignored during the matching phase.
    • Ignore Black and White—Specifies that black and white pixels are ignored during the matching phase.
  • Sat. Threshold—Specifies the threshold used to distinguish between two colors having the same hue values. For more information about saturation threshold, refer to the NI Vision Concepts Manual.

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 color pattern matching function to return.
  • Minimum Score—Specifies the minimum score a template must have for the template to be considered a valid match. This value can range from 0 to 1000, where a score of 1000 indicates a perfect match.
  • Color Score Weight—Determines the percent contribution of the color score to the final color pattern matching score. The software uses the color score weight for the final match ranking. For example, if you use a weight of 1000, the algorithm finds each match by using both color and shape information and then ranks the matches based on their color scores. If the weight is 0, the matches are ranked based on their shape scores. The default is 500, which indicates that the match score is based on an equal combination of the color and shape scores.
  • Search Strategy—Specifies how the color features of the image are used during the search phase. You can choose from the following four strategies:
    • Conservative (default)—Uses the smallest step size, a sub-sampling factor of two, and all the color information present in the template to search for a template. The Conservative strategy is the most reliable method to look for a template in any image at potentially reduced speed.
      Note Note  Use the Conservative strategy if you have multiple matches located very close to each other in the image.
    • Balance—Uses values between the Aggressive and Conservative strategies.
    • Aggressive—Uses values between the Balanced and Very Aggressive strategies.
    • Very Aggressive—Uses the largest step size, the most sub-sampling, and only the dominant color from the template to search for the template. Use this strategy when the color in the template is almost uniform, the template is well contrasted from the background, and there is a good amount of separation between different occurrences of the template in the image. The Very Aggressive strategy is the fastest way to find templates in an image.
  • Color Sensitivity—Specifies the level of sensitivity used to describe the color features in the image. The default is Low sensitivity.

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.