Search for Defects Using Golden Template Comparison
Main Tab
- In the Step Name control, enter a descriptive name for the step.
- Define the golden template to compare to the inspection image using one of the following methods:
- To create a new golden template, complete the following steps:
- Click New Template to launch the NI Vision Template editor.
- Complete the steps in the NI Vision Template Editor to create a golden template. Refer to the NI Vision Template Editor Help for specific instructions about how to define a golden template.
- Click Finish to validate the new template.
- In the Save Template As dialog box, browse to the location where you want to save the template file, enter a File Name, and click OK.
- To use an existing image as the golden template, complete the following steps:
- Click Load from File.
- Browse to the image you want to use as the golden template.
- Click Open.
If the image you selected is not a valid golden template file, complete the following steps to create a golden template based on the image you selected:
- Click Yes to launch the NI Vision Template Editor.
- Adjust the Edge Threshold value until only the edges you want to exclude during the golden template comparison remain.
- Click OK.
- In the Save Template As dialog box, browse to the location where you want to save the template file, enter a File Name, and click OK.
- To create a new golden template, complete the following steps:
![]() |
Tip Click Edit Template to launch the NI Vision Template Editor and modify the currently selected golden template. |
Alignment Tab
- If necessary, adjust the position of the region of interest to correspond with the area of the image you want to search for defects.
For rough alignment of the region of interest within the inspection image, use the mouse to adjust the center of the position of the region of interest. For fine adjustments in the position of the region of interest, use the arrow keys or the Center X, Center Y, and Angle controls. The size of the region of interest cannot be adjusted because the size of the region of interest is based on the size of the specified golden template.
- Verify that the Reposition Region of Interest checkbox is enabled if you want to link the region of interest specified in this step to a previously defined coordinate system.
Link the region of interest to a coordinate system if the position of the object under inspection changes from image to image, and you need to adjust the position of the region of interest to match the new location of the object.
- Specify a Scale value to apply to the golden template if the area in the image you want to compare to the golden template is larger or smaller than the golden template image.
- Select the type of Alignment Correction you want to use to when the golden template is applied to the image.
Settings Tab
- Specify the type of defects to detect using the Look For control.
- Use the Intensity, Ignore Edges, and Edge Thickness controls to adjust for variations in lighting and minor differences along the edges of the image that you want to ignore.
- Use the Threshold Defect Image, Bright Level, and Dark Level controls to set the threshold limits for defects in the image.
- Click OK to save this step to the script.
![]() |
Tip Use the Display button to show only the defects in the image or show the defects as an overlay on the original image. The green defects represent pixels in the inspection image that are brighter than the corresponding pixels in the golden template image. The red defects represent pixels in the inspection image that are darker than the corresponding pixels in the golden template image. |