Inspecting for Multiple Correct Instances of an Object
This example shows the Find Straight Edge, Size, and Decision
Making steps. Follow the instructions in this example to create a
inspection measuring the distance between a blade connectors
fuse and check the fuse integrity regardless of the fuse driver
position or if the fuse is reversed.
Making steps. Follow the instructions in this example to create a
inspection measuring the distance between a blade connectors
fuse and check the fuse integrity regardless of the fuse driver
position or if the fuse is reversed.
Complete the following instructions to configure a Simulate Acquisition
step that simulates acquiring images of fuses.
1. In the Inspection Steps palette, select the Acquire Images tab.
2. Click the Simulate Acquisition step. The property page for the step
opens.
3. In the Step Name control, enter Acquire Fuse.
4. Click the Browse button. The Select an Image File dialog box opens.
5. Navigate to <Vision Builder AI>\DemoImg\Tutorial 3, where
<Vision Builder AI> is the location where Vision Builder AI is
installed.
6. Select the first image, Image 01.jpg, and click Open.
Defining a Feature on which to Base a Coordinate
step based on the Find Straight Edge step you configured.
1. In the Inspection Steps palette, select the Locate Features tab.
2. Click the Set Coordinate System step. The property page for the step
opens.
3. In the Main tab, enter Set Coordinate System in the Step Name
control.
4. In the Settings tab, select Horizontal Motion from the Mode control.
Notice the Origin list. Point 1, the first point of the straight line
detected by the Locate Fuse Left Edge step, is the default origin of the
coordinate system. In this exercise, the location of the origin does not
affect the measurement you need to make. Therefore, use the default
origin.
5. Click OK to add the step to the inspection.
Complete the following instructions to configure a Caliper step that
measures the distance between the blade connectors of the fuse.
1. In the Inspection Steps palette, select the Measure Features tab.
2. Click the Caliper step. The property page for the step opens.
3. In the Main tab, enter Measure Separation in the Step Name
control.
4. Enable the Reposition Region of Interest control.
5. Draw an ROI across the blade connectors, as shown in the picture.
12. Click Add to add this expression to the Expression table.
13. Select the second expression in the Expression table, and click
AND/OR to change the binary operator to OR.
14. Hold down the <Shift> key, and select the second and third expressions
in the Expression table.
15. Click ( ) to group the expressions.
The Logic Calculator property page should resemble the picture.
Complete the following instructions to configure Vision Builder AI to pass
the inspection when the Logic Calculator step passes, regardless of the
results of individual steps in the inspection.
1. In the Inspection Steps palette, select the Use Additional Tools tab.
2. Click the Set Inspection Status step. The property page for the step
opens.
3. In the Step Name control enter Set Inspection Status.
4. In the Inspection Status control select the Equals specified
measurement option, and select Decide Pass/Fail - Step Status for
the value.
5. Make sure the Update Number of Parts Inspected control is enabled.
6. Click OK to add the step to the inspection.
Test the inspection to make sure it returns the results you expect. Click the
Run Inspection Once button to test the remaining images. The next table lists
the test images, the inspection status to expect for each image, and an
explanation of the status.
step that simulates acquiring images of fuses.
1. In the Inspection Steps palette, select the Acquire Images tab.
2. Click the Simulate Acquisition step. The property page for the step
opens.
3. In the Step Name control, enter Acquire Fuse.
4. Click the Browse button. The Select an Image File dialog box opens.
5. Navigate to <Vision Builder AI>\DemoImg\Tutorial 3, where
<Vision Builder AI> is the location where Vision Builder AI is
installed.
6. Select the first image, Image 01.jpg, and click Open.
Defining a Feature on which to Base a Coordinate
System
The fuses can appear shifted horizontally and slightly rotated from one
inspection image to another. Complete the following instructions to
configure a Find Straight Edge step that finds the left edge of the fuse so
that regions of interest in subsequent steps can shift with the fuse.
1. In the Inspection Steps palette, select the Locate Features tab.
2. Click the Find Straight Edge step. The property page for the step
opens.
3. In the Step Name control, enter Locate Fuse Left Edge.
4. Draw a region of interest (ROI) across the left edge of the fuse,
as shown in the picture
Notice that the ROI contains blue search lines. The step searches along
the search lines for sharp transitions in pixel intensities, which usually
represent object edges. The step fits a straight line through the
individual detected edge points of each search line to determine the left
edge of the fuse.
5. Click OK to add the step to the inspection
Setting a Coordinate System
Complete the following instructions to configure a Set Coordinate Systemstep based on the Find Straight Edge step you configured.
1. In the Inspection Steps palette, select the Locate Features tab.
2. Click the Set Coordinate System step. The property page for the step
opens.
3. In the Main tab, enter Set Coordinate System in the Step Name
control.
4. In the Settings tab, select Horizontal Motion from the Mode control.
Notice the Origin list. Point 1, the first point of the straight line
detected by the Locate Fuse Left Edge step, is the default origin of the
coordinate system. In this exercise, the location of the origin does not
affect the measurement you need to make. Therefore, use the default
origin.
5. Click OK to add the step to the inspection.
Measuring the Separation between Connectors
Complete the following instructions to configure a Caliper step that
measures the distance between the blade connectors of the fuse.
1. In the Inspection Steps palette, select the Measure Features tab.
2. Click the Caliper step. The property page for the step opens.
3. In the Main tab, enter Measure Separation in the Step Name
control.
4. Enable the Reposition Region of Interest control.
5. Draw an ROI across the blade connectors, as shown in the picture.
6. In the Settings tab, select the Process named Vertical Min Caliper to
change the direction and orientation of the caliper search lines.
7. In the Limits tab, enable the Minimum Distance control and set the
value to 150. Enable the Maximum Distance control and set the value
to 160.
8. Click OK to add the step to the inspection.
Inspecting the Fuse Conductor
Complete the following instructions to configure Match Pattern steps that
inspect the integrity of the fuse conductor.
1. In the Inspection Steps palette, select the Locate Features tab.
2. Click the Match Pattern step. The NI Vision Template Editor opens.
3. Draw an ROI around the conductor, as shown in the next picture. This
region becomes the pattern matching template.
4. Click Next.
5. Click Finish to accept the template.
6. On the Main tab, enter Match Conductor 1 in the Step Name
control.
7. Make sure the Reposition Region of Interest control is enabled.
8. Redraw or decrease the default green ROI so that it surrounds an area
slightly larger than the template, as shown in the next picture.
9. In the Settings tab, set Number of Matches to Find to 1.
10. Enable the Search for Rotated Patterns control.
11. Set the Angle Range +/– (degrees) control to 10 to enable the step to
locate the best match possible within ±10° of the learned template
angle.
12. In the Limits tab, enable the Minimum Number of Matches control
and set the value to 1.
13. Click OK to add the step to the inspection.
14. Click the Run Inspection Once button twice so that Image 03.jpg
becomes the active image.
A fuse may be inverted when Vision Builder acquires an image of the
fuse. This inversion causes the conductor to look different than the
template, shown in the picture a. To prevent a good but inverted fuse from
failing inspection, you need to learn a pattern matching template for the
inverted instances of the conductor as well, shown in the picture b.
15. In the Inspection Steps palette, select the Locate Features tab.
16. Click the Match Pattern step. The Select a template in the image
dialog box opens.
17. Draw an ROI around the conductor, similar to the region you drew in
step 3.
18. Click OK to learn the inverted template.
19. In the Step Name control, enter Match Conductor 2.
20. Set the Region of Interest control to Match Conductor 1. This
configures the Match Conductor 2 step to use the same ROI that you
previously defined for the Match Conductor 1 step.
21. In the Settings tab, set Number of Matches to Find to 1.
22. Enable the Search for Rotated Patterns control.
23. Set the Angle Range +/– (degrees) control to 10 to enable the step to
locate the best match possible within ±10° of the learned template
angle.
24. In the Limits tab, enable the Minimum Number of Matches control
and set the value to 1.
25. Click OK to add the step to the inspection.
Making Logical PASS/FAIL Decisions
In the previous examples, the inspection would fail if any of the steps in the
inspection failed. In this lesson, because the conductor under inspection can
match only one of the patterns you specified, one of the Match Pattern
steps always fails. If you were to set the Inspection Status to fail if any of
the steps in the inspection fail, the entire inspection will always fail because
one of the Match Pattern steps always fails.
Using the Logic Calculator step, you can create a Boolean result that is
based on the results of the previous inspection steps. The Set Inspection
Status step can use this Boolean result to determine the Inspection Status.
Complete the following instructions to configure a Logic Calculator step
that causes the inspection to pass when the conductor matches either the
template in Match Conductor 1 or Match Conductor 2, and when the
Measure Separation step passes.
1. In the Inspection Steps palette, select the Use Additional Tools tab.
2. Click the Logic Calculator step. The property page opens in the Main
window.
3. In the Step Name control, enter Decide Pass/Fail.
4. In the First Operand frame, set Source to Measure Separation.
Set Measure to Step Status.
Current Value displays the value of the measurement based on the
current image.
5. Make sure Second Operand is set to Constant, and Constant is set
to True.
6. Click Add to add this expression to the Expression table.
7. In the First Operand frame, set Source to Match Conductor 1.
Set Measure to Step Status.
8. Make sure Second Operand is set to Constant, and Constant is set
to True.
9. Click Add to add this expression to the Expression table.
Notice the default binary operator AND in the last column of the
Expression table.
10. In the First Operand frame, set Source to Match Conductor 2.
Set Measure to Step Status.
11. Make sure Second Operand is set to Constant and Constant is set
to True.
13. Select the second expression in the Expression table, and click
AND/OR to change the binary operator to OR.
14. Hold down the <Shift> key, and select the second and third expressions
in the Expression table.
15. Click ( ) to group the expressions.
The Logic Calculator property page should resemble the picture.
16. Click OK to add the step to the inspection.
Setting the Inspection Status
Complete the following instructions to configure Vision Builder AI to pass
the inspection when the Logic Calculator step passes, regardless of the
results of individual steps in the inspection.
1. In the Inspection Steps palette, select the Use Additional Tools tab.
2. Click the Set Inspection Status step. The property page for the step
opens.
3. In the Step Name control enter Set Inspection Status.
4. In the Inspection Status control select the Equals specified
measurement option, and select Decide Pass/Fail - Step Status for
the value.
5. Make sure the Update Number of Parts Inspected control is enabled.
6. Click OK to add the step to the inspection.
Testing the Inspection
Test the inspection to make sure it returns the results you expect. Click the
Run Inspection Once button to test the remaining images. The next table lists
the test images, the inspection status to expect for each image, and an
explanation of the status.
No hay comentarios:
Publicar un comentario