Table Of Contents

Learn Pattern (G Dataflow)

Last Modified: June 25, 2019

Creates a description of the template image which you want to search during the matching phase of pattern matching.

This description data is appended to the input template image. During the matching phase, the template descriptor is extracted from the template image and used to search for the template in the inspection image.

connector_pane_image
datatype_icon

algorithm

Pattern matching algorithm used to learn the template information.

Selecting All learns the template using all of the algorithms.

Name Value Description
All 0

Uses all of the algorithms, one after the other.

Low Discrepancy Sampling 1

Uses a low discrepancy sampling algorithm. This algorithm extracts the most significant information to represent an image. If your template contains large regions of similar grayscale information, a wide aspect ratio, or is very small, use one of the pyramidal matching algorithms instead.

Grayscale Value Pyramid 2

Uses a grayscale value pyramid algorithm. This algorithm uses normalized gray values as features, and is useful when the template does not contain structured information, but has intricate textures for dense edges.

Gradients Pyramid 3

Uses a gradient pyramid algorithm. This algorithm uses filtered edge pixels as features. This algorithm is more resistant to occlusion and intensity changes compared to the grayscale value pyramid, and is often being faster because of a smaller amount of data. However, the strength and reliability of edges reduces at very low resolutions this method requires the user to sometimes work at higher resolutions compared to the gray value method.

datatype_icon

image in

Reference to the inspection image in which you want to search in the template image.

datatype_icon

learn mask

Optional mask image.

This image must be a U8 image. The node learns only those pixels in the source image whose corresponding pixels in the mask are zero. Non-zero pixels are ignored. Do not set this parameter to learn the whole image.

datatype_icon

weight map

Image to specify weights to suppress noise and false defects in the defect map.

Pixels with lower weights are enhanced and pixels with higher weights are suppressed in the defect map. weight map is used with the Calculate Defect Map node.

datatype_icon

angle range

Range of angles for which the template should be learned.

Passing an empty array will cause the node to only search for shift-invariant matches.

datatype_icon

Start Angle

Starting angle of the template.

datatype_icon

End Angle

Ending angle of the template.

datatype_icon

error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

datatype_icon

advanced options

Algorithm-related options for use during the learning phase.

datatype_icon

Item

Matching option for use during the learning phase.

The following values are possible:

Name Value Description
LD Sampling - Search Strategy Support 0

Specifies the aggressiveness of the search strategy available during the matching phase. Three types of search strategies are available. The default is 2.

  1. Conservative—Extracts template information for Conservative matching only.
  2. Balanced—Extracts template information for Balanced and Conservative matching.
  3. Aggressive—Extracts template information for Aggressive, Balanced, and Conservative matching.
LD Sampling - Initial Step Size 1

Specifies the largest number of image pixels to shift the sample across the inspection image during the initial phase of matching. The default values are 5 for the Balanced search strategy and 3 for the Conservative search strategy. If the step size is not an odd integer, the node coerces it to the next smaller odd integer.

The Aggressive search strategy does not support the Initial Step Size option.

LD Sampling - Initial Sample Size 2

Specifies the number of template pixels that you want to include in a sample for the initial phase of matching. The default is 0, which allows the algorithm to compute the Initial Sample Size. For optimal speed, the node coerces sizes that are less than 240 to an integer multiple of 12 and coerces sizes greater than 240 to an integer multiple of 60.

LD Sampling - Initial Sample Size Factor 3

Specifies the size of the sample for the initial phase of rotation-invariant matching as a percent of the template size, in pixels. The default is 0, which causes the node to use the Initial Sample Size. If you provide values for both the Initial Sample Size Factor and the Initial Sample Size, the node uses the Initial Sample Size. For optimal speed, the node coerces sizes that are less than 240 to an integer multiple of 12 and coerces sizes greater than 240 to an integer multiple of 60.

LD Sampling - Initial Angular Accuracy 4

Initial Angular Accuracy sets the angle accuracy, in degrees, to use during the initial phase of matching. The default is 6 degrees. The node coerces the angle to the largest integer smaller than it that evenly divides 360. This option is not used in conjunction with the Aggressive search strategy.

LD Sampling - Final Sample Size 5

Specifies the number of template pixels you want to add to the Initial Sample Size for the final phase of matching. These additional points include edge points. The default is 0, which allows the algorithm to compute the Final Sample Size. For optimal speed, the node coerces sizes that are less than 240 to an integer multiple of 12 and coerces sizes greater than 240 to an integer multiple of 60.

LD Sampling - Final Sample Size Factor 6

Specifies the size of the sample for the final phase of matching as a percent of the edge points in the template, in pixels. The default is 0, which causes the node to use the Final Sample Size. If you provide values for both the Final Sample Size Factor and the Final Sample Size, the node uses the Final Sample Size. For optimal speed, the node coerces sizes that are less than 240 to an integer multiple of 12 and coerces sizes greater than 240 to an integer multiple of 60.

LD Sampling - Final Angular Accuracy 7

Sets the angle accuracy, in degrees, to use during the final phase of the matching. The default is 1 degree. Use subpixel accuracy to achieve angle accuracy less than the default. This value must be no greater than the value for Initial Angular Accuracy. The node coerces the angle to the largest integer smaller than it that evenly divides 360. This option is not used in conjunction with the Aggressive search strategy.

LD Sampling - Subpixel Sample Size 8

Specifies the number of template pixels that you want to include in a sample for the subpixel phase of matching. The default is 0, which allows the algorithm to compute the Subpixel Sample Size. For optimal speed, the node coerces sizes that are less than 240 to an integer multiple of 12 and coerces sizes greater than 240 to an integer multiple of 60.

LD Sampling - Subpixel Sample Size Factor 9

Specifies the size of the sample for the subpixel phase of matching as a percent of the template size, in pixels. The default is 0, which causes the node to use the Subpixel Sample Size. For optimal speed, the node coerces sizes that are less than 240 to an integer multiple of 12 and coerces sizes greater than 240 to an integer multiple of 60.

LD Sampling - Match Offset X Position 10

Specifies the number of pixels the node shifts the origin of the template from the center of the template image. The match offset is used by the Match Pattern node to set the Position element of the resulting Matches cluster for each template match within a target image. The default value is (0, 0), which sets the center of the template image as the origin of the template.

LD Sampling - Match Offset Y Position 11

Specifies the number of pixels the node shifts the origin of the template from the center of the template image. The Match offset is used by the Match Pattern node to set the Position element of the resulting Matches cluster for each template match within a target image. The default value is (0, 0), which sets the center of the template image as the origin of the template.

LD Sampling - Match Offset Angle 12

Specifies the angle by which each match is rotated round the origin of the template. The angle offset is used by the Match Pattern node to set the Angle element of the resulting Matches cluster for each template match within a target image. The default value is 0 which does not change the angle of the matches.

Pyramid - Subpixel Sample Size 100

Specifies the number of template pixels that you want to include in a sample for the subpixel phase of matching. The default is 0, which allows the algorithm to compute the Subpixel Sample Size. For optimal speed, the node coerces sizes that are less than 240 to an integer multiple of 12 and coerces sizes greater than 240 to an integer multiple of 60.

Pyramid - Subpixel Sample Size Factor 101

Specifies the size of the sample for the subpixel phase of matching as a percent of the template size, in pixels. The default is 0, which causes the node to use the Subpixel Sample Size. For optimal speed, the node coerces sizes that are less than 240 to an integer multiple of 12 and coerces sizes greater than 240 to an integer multiple of 60.

Pyramid - Match Offset X Position 102

Specifies the number of pixels the node shifts the origin of the template from the center of the template image. The match offset is used by the Match Pattern node to set the Position element of the resulting Matches cluster for each template match within a target image. The default value is (0, 0), which sets the center of the template image as the origin of the template.

Pyramid - Match Offset Y Position 103

Specifies the number of pixels the node shifts the origin of the template from the center of the template image. The Match offset is used by the Match Pattern node to set the Position element of the resulting Matches cluster for each template match within a target image. The default value is (0, 0), which sets the center of the template image as the origin of the template.

Pyramid - Match Offset Angle 104

Specifies the angle by which each match is rotated round the origin of the template. The angle offset is used by the Match Pattern node to set the Angle element of the resulting Matches cluster for each template match within a target image. The default value is 0 which does not change the angle of the matches.

Pyramid - Max Pyramid Level To Store Data 105

Specifies the pyramid level up to which data is stored in a learned template when rotated templates are to be learned. The template data for pyramid levels less than this value is stripped away. A value of 0 implies that no data has been stripped, making the template the largest, while progressively higher values up to the computed Max Pyramid Level result in progressively smaller templates. The default value is 2, which means data for levels 1 and 0 is stripped. When learning a large template for a large angle range, the amount of data generated can be fairly significant and this parameter can be used to control the size. However, all the removed data needs to be re-computed by the Match Pattern node, which increases match times. A trade-off needs to be made between a smaller template size and faster match times. Learning for Shift is not affected by this parameter.

Pyramid - Percent of Pixels to keep for Gradient Template 106 Specifies the percentage of gradient values that needs to be stored as part of the template. The default value is -1. The value -1 indicates an optimal value for the threshold will be computed. The minimum value is 5. The maximum value is 80.
Pyramid - Pre Process 107 Specifies whether to pre-process the template image and the input image while learning and matching. The default value for this option is 0 indicating no pre-processing.
  • 0 - No Processing.
  • 1 - Sobel and log transform. Template and match image are processed with sobel filter and log transform lookup table.
  • 2 - Sobel. Template and Match Image are processed with Sobel filter.
  • 3 - Non Linear Diffusion Filter. template and Match Image Pyramids are processed with Non Linear Diffusion (Anisotropic Diffusion) filter. This option reduces noise and improves edge contrast.
datatype_icon

Value

Value of the option you want to use during the learning phase.

datatype_icon

template image out

Reference to the template.

This template image contains the data that defines the template pattern for the matching phase.

datatype_icon

template report

Parameter information used while learning the template.

datatype_icon

Template Contrast

Contrast value for the template used for learning.

datatype_icon

Grayvalue Max Pyramid Level

Maximum pyramid level the template was learned when using the Grayscale Value Pyramid algorithm.

datatype_icon

Grayvalue Optimal Pyramid Level

Optimal pyramid level as computed by the algorithm at which matching should be carried out when using the Grayscale Value Pyramid algorithm.

datatype_icon

Gradient Max Pyramid Level

Maximum pyramid level the template was learned when using the Graidents Pyramid algorithm.

datatype_icon

Gradient Optimal Pyramid Level

Optimal pyramid level as computed by the algorithm at which matching should be carried out when using the Graidents Pyramid algorithm.

datatype_icon

error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application


Recently Viewed Topics