Home
NI Vision Builder for Automated Inspection Tutorial
Contents
1. Figure 6 5 Creating a New Transition You can change the shape of the transition by dragging the anchor point at the center of the transition You can move the location of the transition label by clicking the label and dragging it to the new location NI Vision Builder for Automated Inspection Tutorial 6 4 ni com Chapter 6 Branching and Decision Making Tip When drawing a transition click once on the state diagram to set the anchor point for the transition The anchor point allows you to draw an arc instead of a straight line to represent the transition 14 Double click the transition to launch the Edit Transition dialog box which is used to configure the transition 15 In the Transition Name control enter Part Detected and click OK 16 Create another transition named Part OK between the Inspect Part and Pass Part states The state diagram should now resemble the state diagram shown in Figure 6 6 Start default default k Part Presence Part Detected Che End Figure 6 6 Completed State Diagram for the Inspection Note You can remove a state or transition from the inspection by selecting the object you want to remove and pressing the lt Delete gt key Note You cannot rename or remove the default transition of a state gi Each state in an inspection is intended to contain a separate set of inspection steps To access the functions in a state click the state in
2. Next you will create transitions between the various inspection states Notice that every state has a default transition You can also create additional transitions between states based on measurement results or variable values 3 Note The default transition occurs if the transition requirements for other possible transitions are not met 7 Click the arrow of the Check Part Presence default transition and drag it back to the Check Part Presence state This creates a loop that will run the steps in the Check Part Presence State until a part is detected Click the End point and drag it to the bottom of the state diagram 9 Click the Inspect Part default transition and drag it to the Fail Part state 10 Click the Fail Part default transition and drag it to the End point 11 Click the Pass Part default transition and drag it to the End point National Instruments Corporation 6 3 NI Vision Builder for Automated Inspection Tutorial Chapter 6 Branching and Decision Making The state diagram should now resemble the state diagram shown in Figure 6 4 Start default default k Part Presence Che End Figure 6 4 Configuring the Default Transitions 12 Right click the Check Part Presence state and select Create New Transition 13 Click the Inspect Part state to create a transition between the Check Part Presence and Inspect Parts states as shown in Figure 6 5 default Chetk Part Presence
3. 0 0 1000 Figure 2 2 Limiting the Search Region NI Vision Builder for Automated Inspection Tutorial 2 4 ni com Chapter 2 Checking for the Presence of a Part On the Template tab drag the red crosshair mark in the template image to the left edge of the sprayer base as shown in Figure 2 3 This changes the focal point of the template The focal point indicates the part of the template that you want to return as the match location By default the focal point is the center of the template You can modify the focal point by moving the red crosshair or by specifying a Match Offset Later in this inspection you use the match location as the origin of a coordinate system Main Template Settings Limits Template Image p e Template Size width 214 Height 94 Match Offset x 33 amp Y 2 amp New Template Edit Template Focal Point 10 11 National Instruments Corporation Figure 2 3 Adjusting the Focal Point of the Template On the Settings tab set Number of Matches to Find to 1 On the Limits tab enable the Minimum Number of Matches control and set the value to 1 Click OK to add the step to the inspection 2 5 NI Vision Builder for Automated Inspection Tutorial Chapter 2 Checking for the Presence of a Part Setting a Coordinate System Complete the following instructions to configure a Set Coordinate System step based on the Match Patt
4. Ce se Next Image Uses the next inspection image the next time the inspection executes Select Next Image Specifies the inspection image to process the next time the inspection executes lke E El LA E This button applies only to inspections that either contain a Simulate Acquisition step or have Simulate Smart Camera Simulate Embedded Vision System or Simulate Compact Vision System selected as the target NI Vision Builder for Automated Inspection Tutorial 1 10 ni com Inspection Interface Chapter 1 Introduction to Vision Builder Al After an inspection is configured use the Inspection interface to run the inspection and or deploy your system Complete the following instructions to run an inspection from the Inspection interface Tip Ifthe Vision Builder AI Configuration interface is already open select File Switch to Inspection Interface to open the current inspection in the Inspection interface National Instruments Corporation Select Start All Programs National Instruments Vision Builder AI to launch the Vision Builder AI On the Vision Builder AI welcome screen click Browse under Run Inspection Select the inspection that you want to run and click OK to open the inspection in the Inspection Interface Click the Start Inspection button Vision Builder AI begins running the inspection and updating the three areas of the Inspection interface with the most recent inspecti
5. Chapter 3 Inspecting Objects for Correct Measurements l NI Calibration Training Interface Gasket Calibration iol x Specify a different scale for the Y axis if your sensor has rectangular pixels or if you want to account for scaling in only one direction Click Next to define values for the Y axis I Specify a different scale for the Y axis Select 2 points by clicking the image then define the distance between the points in real world units Select the point in the list to adjust X and Y coordinates Points Points JV 1 User Point 1 180 441 JV 2 User Point 2 450 441 r Distances Image Real World Length 270 00 50 Unit pixels millimeter v 0 10 20 30 40 50 mn co lt lt Previous Next gt gt gt 640x480 1X 0 0 p p 2m TA OK Cancel Help Figure 3 1 Specifying the Pixel Ratio 15 Inthe Distances control enter 50 for the Real World value and select millimeter for the Unit 16 Click Next 17 Ignore the Compute Lens Distortion Model option and click Next In the Specify Calibration Axis step you can define the origin and angle of the calibration axis anywhere in the image By default the top left pixel in the image is the calibration axis origin and the horizontal axis of the image is the calibration axis angle Use the default calibration axis settings for this exercise Tip In some applications you may want to measure between a fixed refere
6. 5 L ea wg V Display Result Image for this State 3 ae Aa e EF a a o SS ILE PASS mz Simulate Acquisition Simulates the Measure Separation Match Conductor 1 Match Conductor 2 Decide Pass Fail Set Inspection Status Distance 153 34 pix Matchgs 1 Matches 0 Inspection Status Pass lt gt Too few matches Found are acquisition of images by reading images from file Select Ingage Selects a new image to inspect 2H a hasl e lt 1 Main Window 2 Overview Window 3 Inspection Steps Palette 4 State Configuration Window National Instruments Corporation Figure 1 3 Vision Builder Al Configuration Interface Main window Displays the image being processed property pages for some inspection steps or the state diagram for the inspection Use the Main window to define regions of interest in an image configure step parameters for some steps and create modify the state diagram for an inspection 1 5 NI Vision Builder for Automated Inspection Tutorial Chapter 1 Introduction to Vision Builder Al e Overview window Displays a thumbnail view of either the current inspection image or the state diagram for the inspection e Inspection Steps palette Lists and describes the steps that you use to create your inspection When you click on most steps the palette tran
7. Checking for the Cap Using the Caliper You can check for the presence of the cap on a spray bottle by using the Caliper step to find two edges where the cap is supposed to be and measuring the distance between them Complete the following instructions to configure a Caliper step to check for the presence of the spray bottle cap 1 In the Overview window click the Inspect Part state on the state inspect Part diagram In the Inspection Steps palette select the Measure Features tab Click the Caliper step The property page for the step opens In the Step Name control enter Check Cap Presence Ae eS Draw an ROI around the area in the image where a cap should appear as shown in Figure 6 8 Check Cap Presence TT Figure 6 8 Checking for Cap Presence NI Vision Builder for Automated Inspection Tutorial 6 8 ni com 9 10 Chapter 6 Branching and Decision Making On the Settings tab select the Process named Horizontal Max Caliper to change the direction and orientation of the caliper search lines Set the Gap control to 10 Edge Strength to 40 and Smoothing to 12 to ensure that the step correctly detects the edges of the cap On the Limits tab enable the Minimum Distance control and set the value to 140 Enable the Maximum Distance control and set the value to 160 Click OK to add the step to the inspection Setting the Inspection Status Complete the following instructions to add a Set Insp
8. 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 Inthe Step Name control enter Locate Fuse Left Edge Draw a region of interest ROD across the left edge of the fuse as shown in Figure 4 1 Locate Fuse Left Ed Figure 4 1 Finding a Straight Edge NI Vision Builder for Automated Inspection Tutorial 4 2 ni com Chapter 4 Inspecting for Multiple Correct Instances of an Object 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 System step based on the Find Straight Edge step you configured 1 Inthe Inspection Steps palette select the Locate Features tab 2 Click the Set Coordinate System step The property page for the step dei opens 3 Inthe 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 coordi
9. In the Settings tab set Number of Matches to Find to 1 Enable the Search for Rotated Patterns control 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 In the Limits tab enable the Minimum Number of Matches control and set the value to 1 Click OK to add the step to the inspection 4 7 NI Vision Builder for Automated Inspection Tutorial Chapter 4 Inspecting for Multiple Correct Instances of an Object Making Logical PASS FAIL Decisions In the previous lessons 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 Inthe Ins
10. CAN BE IMPAIRED BY ADVERSE FACTORS INCLUDING BUT NOT LIMITED TO FLUCTUATIONS IN ELECTRICAL POWER SUPPLY COMPUTER HARDWARE MALFUNCTIONS COMPUTER OPERATING SYSTEM SOFTWARE FITNESS FITNESS OF COMPILERS AND DEVELOPMENT SOFTWARE USED TO DEVELOP AN APPLICATION INSTALLATION ERRORS SOFTWARE AND HARDWARE COMPATIBILITY PROBLEMS MALFUNCTIONS OR FAILURES OF ELECTRONIC MONITORING OR CONTROL DEVICES TRANSIENT FAILURES OF ELECTRONIC SYSTEMS HARDWARE AND OR SOFTWARE UNANTICIPATED USES OR MISUSES OR ERRORS ON THE PART OF THE USER OR APPLICATIONS DESIGNER ADVERSE FACTORS SUCH AS THESE ARE HEREAFTER COLLECTIVELY TERMED SYSTEM FAILURES ANY APPLICATION WHERE A SYSTEM FAILURE WOULD CREATE A RISK OF HARM TO PROPERTY OR PERSONS INCLUDING THE RISK OF BODILY INJURY AND DEATH SHOULD NOT BE RELIANT SOLELY UPON ONE FORM OF ELECTRONIC SYSTEM DUE TO THE RISK OF SYSTEM FAILURE TO AVOID DAMAGE INJURY OR DEATH THE USER OR APPLICATION DESIGNER MUST TAKE REASONABLY PRUDENT STEPS TO PROTECT AGAINST SYSTEM FAILURES INCLUDING BUT NOT LIMITED TO BACK UP OR SHUT DOWN MECHANISMS BECAUSE EACH END USER SYSTEM IS CUSTOMIZED AND DIFFERS FROM NATIONAL INSTRUMENTS TESTING PLATFORMS AND BECAUSE A USER OR APPLICATION DESIGNER MAY USE NATIONAL INSTRUMENTS PRODUCTS IN COMBINATION WITH OTHER PRODUCTS IN A MANNER NOT EVALUATED OR CONTEMPLATED BY NATIONAL INSTRUMENTS THE USER OR APPLICATION DESIGNER IS ULTIMATELY RESPONSIBLE FOR VERIFYING AND VALIDATING THE SUITABILITY OF NATIONAL IN
11. Image Frames Find Left Edge 12 3 4 6 fe Figure 5 6 Finding the Left Edge of the Plank The step searches along the search line and marks the location of the left edge with a red square 8 Click OK to add the step to the inspection NI Vision Builder for Automated Inspection Tutorial 5 10 ni com Chapter 5 Inspecting an Object that Spans Two Image Frames Calculating the Width of the Part Now that you have located the right edge of the part in one image and the left edge of the part in another image you need to combine the measurements from the two images to determine the width of the part Use the Calculator step to combine the two measurements and compute the width Refer to the following equations as you configure the step Right LC Right RC Origin R Origin L 5 1 Part Width Right LC Left LC 5 2 where Right LC The x position of the right edge in the calibration axis of the left edge Right RC The x position of the right edge in the calibration axis of the right edge This corresponds to the calibrated X position result of the Find Right Edge step Origin R The x position of the origin in the calibration axis of the right edge Origin L The x position of the origin in the calibration axis of the left edge Left LC The x position of the left edge in the calibration axis of the left edge This corresponds to the calibrated x position result of the Find Left Edge
12. Less to automatically wire the numeric constant and y input together 9 Type 40 5 to set the maximum width a plank can be to pass the inspection 10 Click the up arrow in the Functions palette to return to the main palette NI Vision Builder for Automated Inspection Tutorial 5 16 ni com Chapter 5 Inspecting an Object that Spans Two Image Frames 11 Select the Comparison palette 12 Click the Greater operator Click inside the Calculator diagram below the Less operator 13 Connect the wire between Subtract and Part Width to the x input of the Greater operator 14 Click the up arrow in the Functions palette to return to the main palette 15 Select the Numeric palette 16 Click the Num Const operator 17 Click close enough to the y input of Greater to automatically wire the numeric constant and y input together 18 Type 39 5 to set the minimum width a plank can be to pass the inspection 19 Click the up arrow in the Functions palette to return to the main palette 20 Select the Boolean palette 21 Click the And operator Click close enough to the left side of Step Result to wire the two elements together 22 Connect the Less output to the x input of And 23 Connect the Greater output to the y input of And Your completed Calculator diagram should look similar to the diagram shown in Figure 5 11 Find Right Edge Edge 1 Position Calibrated Right LC Figure 5 11 Calculator
13. Make sure that the Cycle Through Folder Images control is enabled so that Vision Builder AI loads a different simulation image from the folder each time the step is run By default Vision Builder AI returns measurements in pixel units If you want the inspection to return measurements in real world units you need to map pixel units to real world units through a process called spatial calibration 8 Click the Calibration tab 9 Click Create Calibration to launch the calibration training interface 10 In the Calibration Name control enter Gasket Calibration 11 Click Next For this example assume that the camera that acquired the inspection images is perpendicular to the image plane and lens distortion is negligible Based on these assumptions you can use Point Distance Calibration to calibrate your images Point Distance Calibration transforms a pixel coordinate to a real world coordinate through scaling in the x horizontal and y vertical directions 12 Select the Point Distance Calibration option and click Next 13 Make sure that the current image is selected and click Next 14 Carefully click the 0 mm and 50 mm markings on the ruler at the bottom of the image as shown in Figure 3 1 Tip You may need to use the zoom buttons below the image to accurately click the ruler markings After zooming in scroll down to see the ruler at the bottom of the image NI Vision Builder for Automated Inspection Tutorial 3 2 ni com
14. Measure Separation Distance 154 33 pix Match Conductor 1 Matches 1 1 T 7 T T i 0 0 10 0 20 0 30 0 40 0 50 0 60 0 Match Conductor 2 RIMINI Matches 0 Too few matches found yj Processing Time ms 1 Results Panel 3 Inspection Statistics Panel 2 Display Window NI Vision Builder for Automated Inspection Tutorial Figure 1 6 Vision Builder Al Built in Inspection Interface e Results panel Lists the steps in the inspection by name For each inspection step Vision Builder displays the step type result PASS or FAIL measurement made and a comment explaining the reason of a FAIL Inspection Status shows the result of the complete inspection e Display window Displays the part under inspection ni com Chapter 1 Introduction to Vision Builder Al e Inspection Statistics panel Contains three indicators that display the yield ratio between PASS and FAIL active versus idle time and processing time of the inspection Running an Inspection Vision Builder AI allows you to run inspections from both the Configuration and Inspection interfaces The following sections describe the options for running an inspection in Vision Builder AI Configuration Interface Run an inspection from the Configuration interface during development to test and debug inspections The Highlight Execution Pause and Single Step options are useful for debugging inspections Table 1 1 lists the
15. Step Name control enter Set Inspection Status 4 In the Inspection Status control select the Set to measurement value 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 Table 4 1 lists the test images the inspection status to expect for each image and an explanation of the status Table 4 1 Expected Results for the Fuse Inspection Image Name Inspection Status Explanation Image 01 jpg PASS All steps pass but one Match Pattern step Image 02 jpg PASS All steps pass but one Match Pattern step Image 03 jpg PASS All steps pass but one Match Pattern step Image 04 jpg PASS All steps pass but one Match Pattern step Image 05 jpg PASS All steps pass but one Match Pattern step Image 06 jpg FAIL The Measure Separation step fails because the blade connectors are too close together Image 07 jpg FAIL Both Match Pattern steps fail because the conductor is blown Image 08 jpg FAIL Both Match Pattern steps fail because the conductor is melted NI Vision Builder for Automated Inspection Tutorial 4 10 ni com Chapter 4 Inspecting for Multiple Correct Instances of an Object Saving the
16. be defined for the inspection is the transition between the Check Pin Gap and Fail Inspection states that occurs when the pins on the component fail inspection Complete the following instructions to configure the Failed transition 1 Double click the Failed transition Chapter 7 2 Inthe Edit Transition dialog box modify the controls to transition when Measure Gap Step Status is Fail 3 Click OK to close the dialog box Testing the Inspection Test the images in the Tutorial 6 folder to make sure the inspection returns the correct results Click the Run Inspection Once button to test the remaining images Table 7 1 displays the expected results for each image Table 7 1 Expected Results for the State Diagram Looping Inspection Image Name Inspection Status Explanation Image 01 jpg PASS All pins are present and straight Image 02 jpg PASS All pins are present and straight Image 03 jpg PASS All pins are present and straight Image 04 jpg FAIL Third pin is bent Image 05 jpg PASS All pins are present and straight Image 06 jpg FAIL Fifth pin is bent Image 07 jpg PASS All pins are present and straight Image 08 jpg FAIL Seventh pin is bent National Instruments Corporation 7 13 NI Vision Builder for Automated Inspection Tutorial Looping and Variables Chapter 7 Looping and Variables Saving the Inspection Complete the following instructions to s
17. 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 Figure 4 3 This region becomes the pattern matching template t NI Vision Template Editor Select Template Region Brell gt olg 640x480 1 05X 8 bit image 255 592 166 gt lt lt Previous Next gt gt li Finish Cancel Help Figure 4 3 Creating a Template Pattern 4 Click Next Click Finish to accept the template On the Main tab enter Match Conductor 1 in the Step Name control 7 Make sure the Reposition Region of Interest control is enabled National Instruments Corporation 4 5 NI Vision Builder for Automated Inspection Tutorial Chapter 4 Inspecting for Multiple Correct Instances of an Object 8 Redraw or decrease the default green ROI so that it surrounds an area slightly larger than the template as shown in Figure 4 4 Figure 4 4 Limiting the Search Region 9 Inthe 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 enab
18. in Vision Builder AI is represented by a state diagram Complete the following instructions to create a state diagram to define the inspection 1 Click the Toggle Main Window View button on the toolbar to bring max the state diagram to the Main window Start default default End Figure 6 1 Default Inspection State Diagram National Instruments Corporation 6 1 NI Vision Builder for Automated Inspection Tutorial Chapter 6 Branching and Decision Making Double click the Inspect state to launch the Edit State Name dialog In the State Name control enter Check Part Presence and Right click an open area on the state diagram and select Create New State to add a new state to the inspection as shown in Figure 6 2 The Edit State Name dialog box opens Start default k Part Presence default Che Create New State Create New End Point End Import Inspection Figure 6 2 Creating a New Inspection State 2 box 3 click OK 4 5 NI Vision Builder for Automated Inspection Tutorial In the State Name control enter Inspect Part 6 2 ni com Chapter 6 Branching and Decision Making 6 Create two more states named Fail Part and Pass Part The state diagram should now resemble the state diagram shown in Figure 6 3 Start default Chetk Part Presence default End o gt default default rssrat default Figure 6 3 Adding New States to the Inspection
19. measurements to an external device Add one of the Communication steps Save inspection Figure 1 1 Instructions for Creating a Basic Vision Builder Al Inspection NI Vision Builder for Automated Inspection Tutorial 1 2 ni com Chapter 1 Introduction to Vision Builder Al Add Vision Assistant or Filter Image step Does the image need to be enhanced What type of inspection do you need to perform Location Presence Absence Identification Do you want to measure Add step from Add step from Add step from H Locate Features Check for Presence Identify Parts distances between object edges palette palette palette Add steps from Yes Locate Features palette Add Caliper step Add Geometry step Do you want to add another step Yes Figure 1 2 Adding Inspection Steps to a Vision Builder Al Inspection National Instruments Corporation 1 3 NI Vision Builder for Automated Inspection Tutorial Chapter 1 Introduction to Vision Builder Al Vision Builder Al Configuration Interface Vision Builder AI has two modes of operation Configuration and Inspection Use the Configuration interface to configure and test your inspection Use the Inspection interface to deploy the software and perform online or offline visual inspection Complete the following instructions to open the Visi
20. step Setting Calculator Step Inputs and Outputs ig ik Complete the following instructions to configure a Calculator step to select the input measurements from the previous Find Right Edge and Find Left Edge steps and create output results for the calculated values 1 In the Inspection Steps palette select the Use Additional Tools tab 2 Click the Calculator step The Calculator Setup Wizard opens 3 Click Next to proceed with the wizard Notice the Input Measurements list The list contains all of the measurable data from each of the previous steps in the inspection National Instruments Corporation 5 11 NI Vision Builder for Automated Inspection Tutorial Chapter 5 Inspecting an Object that Spans Two Image Frames 9 10 11 12 Select the following measurements from the Input Measurements list e Find Right Edge Edge 1 X Position Calibrated e Find Left Edge Edge 1 X Position Calibrated Click Next Click Add New Output Result A new output appears in the Output Results list In the Name control enter Part Width This output will contain the results of Equation 5 2 Make sure Type is set to Numeric Click Add New Output Result again In the Name control enter Right LC This output will contain the results of Equation 5 1 Make sure Type is set to Numeric Click Finish to close the Calculator Setup Wizard The Main window now displays a diagram with the measurement inputs and result ou
21. this chapter to create an inspection that measures the distance between holes in a gasket to verify that the gasket conforms to manufacturing specifications 3 Note Launch Vision Builder AI if it is not open Refer to the Vision Builder AI Configuration Interface section of Chapter 1 Introduction to Vision Builder AI for more information Creating a New Inspection Select File New to load a new blank Vision Builder AI inspection Acquiring and Calibrating Inspection Images For simplicity this tutorial instructs you to use the Simulate Acquisition step However in your real world inspection use one of the other image acquisition steps to acquire images of the object under inspection Complete the following instructions to configure a Simulate Acquisition step that simulates acquiring images of gaskets 1 2 b e National Instruments Corporation In the Inspection Steps palette select the Acquire Images tab Click the Simulate Acquisition step The property page for the step opens In the Step Name control enter Acquire Gasket Click the Browse button The Select an Image File dialog box opens Navigate to lt Vision Builder AI gt DemoImg Tutorial 2 where lt Vision Builder AI gt is the location where Vision Builder AI is installed Select the first image Image 01 jpg and click Open 3 1 NI Vision Builder for Automated Inspection Tutorial Chapter 3 Inspecting Objects for Correct Measurements 7
22. to the inspection NI Vision Builder for Automated Inspection Tutorial 6 10 ni com Chapter 6 Branching and Decision Making Figure 6 9 shows the overlays for both Pass and Fail images Figure 6 9 Creating Custom Overlays for Images that Pass and Fail Configuring State Transitions Once you have configured all of the states in the inspection and created transitions between the states you need to define the conditions that trigger a transition between inspection states Complete the following instructions to define the transitions between inspection states 1 Click the Toggle Main Window View button to display the state diagram in the Main window 2 Double click the Part Detected transition to launch the Edit Transition dialog box which is used to configure the transition National Instruments Corporation 6 11 NI Vision Builder for Automated Inspection Tutorial Chapter 6 Branching and Decision Making 3 In the Edit Transition dialog box modify the controls to transition when Locate Bottle Matches is Equal to 1 as shown in Figure 6 10 Edit Transition Transition Name Part Detected Transition will be activated when the Following condition is met Measurement Locate Bottle Matches v is Equal a to 1 00 a Current Value 0 Figure 6 10 Configuring the Part Detected Transition 4 Click OK to close the Edit Transition dialog box 5 Double click the Part OK tr
23. tort including negligence Any action against National Instruments must be brought within one year after the cause of action accrues National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control The warranty provided herein does not cover damages defects malfunctions or service failures caused by owner s failure to follow the National Instruments installation operation or maintenance instructions owner s modification of the product owner s abuse misuse or negligent acts and power failure or surges fire flood accident actions of third parties or other events outside reasonable control Copyright Under the copyright laws this publication may not be reproduced or transmitted in any form electronic or mechanical including photocopying recording storing in an information retrieval system or translating in whole or in part without the prior written consent of National Instruments Corporation National Instruments respects the intellectual property of others and we ask our users to do the same NI software is protected by copyright and other intellectual property laws Where NI software may be used to reproduce software or other materials belonging to others you may use NI software only to reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction Trademarks LabVIEW National Instruments NI ni com the Nati
24. world units Select the point in the list to adjust X and Y coordinates 38 39 40 41 42 640x480 1X 422 269 penna x come o Figure 5 3 Defining the Pixel to Real World Ratio 15 In the Distances control enter 4 for the Real World value and select centimeter for the Unit 16 Click Next 17 Ignore the Compute Lens Distortion Model option and click Next NI Vision Builder for Automated Inspection Tutorial 5 6 ni com Chapter 5 Inspecting an Object that Spans Two Image Frames 18 In the Specify Calibration Axis step click the 38 cm marking to define it as the origin of the calibration axis Draw a line horizontally and to the right along the edge of the ruler to define the angle of the calibration axis as shown in Figure 5 4 X NI Calibration Training Interface Calibrate Plank Right 2 Egizi Select the origin of the calibration axis and the angle of the X axis relative to the horizontal axis of the image You can draw a line in the image to specify the origin and X axis angle Axis Origin x Y User Defined x Jes 346 Axis Angle Angle Value X Axis Angle degrees Angle Offset 41 gt 0 f X Axis Point X Axis Point User Defined oa Pea 39 40 41 42 43 640x480 1X 526 257 4 P RID T Figure 5 4 Defining the Origin and Angle of the Calibration Axis 19 Set the Axis Reference control to Direct 20 Click OK to learn the calibra
25. Diagram with Decision Making Abilities 24 In the Calculator step property page click the Limits tab 25 Enable the Step Result is True checkbox 26 Click OK to add the step to the inspection National Instruments Corporation 5 17 NI Vision Builder for Automated Inspection Tutorial Chapter 5 Inspecting an Object that Spans Two Image Frames Setting the Inspection Status Complete the following instructions to add a Set Inspection Status step to determine whether the inspection passes or fails 1 Inthe Inspection Steps palette select the Use Additional Tools tab 2 Click the Set Inspection Status step The property page for the step opens 3 Inthe Inspection Status control Select the Set to FAIL if any previous step fails option 4 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 Table 5 1 lists the test images the inspection status to expect for each image and an explanation of the status 3 Note Results may vary slightly based on the accuracy of the calibration and the edge detection location Table 5 1 Expected Results for the Plank Inspection Image Name Part Width Inspection Status Image 01 jpg 39 99 cm PASS Image 02 jpg 40 12 cm PASS Image 03 jpg 40 25 cm PASS Image 04 jpg 39 23 cm too short FAIL Image 05 jpg 40 89 cm to
26. Folder Images control is enabled so that Vision Builder AI loads a different simulation image from the folder each time the step is run Click the Calibration tab Click Create Calibration to launch the calibration training interface 10 In the Calibration Name control enter Plank Calibration Right 11 Click Next Again assume that the camera that acquired the inspection images is perpendicular to the image plane and lens distortion is negligible 12 Select the Point Distance Calibration option and click Next 13 Make sure the current image is selected and click Next National Instruments Corporation 5 5 NI Vision Builder for Automated Inspection Tutorial Chapter 5 Inspecting an Object that Spans Two Image Frames 14 Carefully click the 38 cm and 42 cm markings on the ruler at the bottom of the image as shown in Figure 5 3 7 Tip You may need to use the zoom buttons below the image to accurately click the ruler markings After zooming in scroll down to see the ruler at the bottom of the image Xl NI Calibration Training Interface Untitled 1 x ES Step 4 Specify Real World Distances Specify a different scale for the Y axis if your sensor has rectangular pixels or if you want to account for scaling in only one direction Click Next to define values for the Y axis I Specify a different scale for the Y axis Select 2 points by licking the image then define the distance between the points in real
27. I returns the centers of mass for the holes as their locations 1 Inthe Inspection Steps palette select the Measure Features tab 7 2 Click the Geometry step The property page for the step opens eet 3 Inthe Step Name control enter Check Top Distance 4 Inthe Geometric Feature control select the Distance measurement 5 Select points 1 and 3 by clicking the points in the image or selecting the points from the Available Points list 6 Inthe Limits tab enable the Minimum Distance control and set it to 32 Enable the Maximum Distance control and set it to 35 7 Click OK to add the step to the inspection Complete the following instructions to measure the distance from the large hole to the bottom small hole to inspect whether the distance meets specifications 1 Right click the Top Distance step in the State Configuration window and select Copy 2 Right click the Top Distance step again 3 Select Paste A copy of the Top Distance step is placed after the original step 4 Double click the Top Distance copy or click the Edit Step button to launch the property page of the step for editing 5 Inthe Step Name control enter Check Bottom Distance National Instruments Corporation 3 7 NI Vision Builder for Automated Inspection Tutorial Chapter 3 Inspecting Objects for Correct Measurements 6 Inthe Geometric Feature control select the Distance measurement 7 From the Available Points list select 2 and 3 whic
28. Inspection Complete the following instructions to save the example inspection Cee Select File Save or click the Save button on the toolbar 2 Navigate to the location where you want to save the inspection 3 Inthe File Name control enter Tutorial 3 vbai 4 Click Save to save the inspection Y Tip Select File Inspection Properties to add a short description or comments about the inspection National Instruments Corporation 4 11 NI Vision Builder for Automated Inspection Tutorial Inspecting an Object that Spans Two Image Frames This chapter introduces the Select Image and Calculator steps Assume that you need to measure the width of a wide wooden plank with high accuracy The only cameras available for the application have low pixel resolutions To measure the width of a plank you need to locate its left and right edges If you were to set up the imaging system so both edges of a plank fit within an available camera s field of view the resulting image detail would be too low to yield accurate measurements Because the required image detail exceeds the pixel resolution capability of a single camera two cameras per plank are needed one camera to acquire an image of the left edge and one camera to acquire an image of the right edge Follow the instructions in this chapter to create an inspection that measures the width of a wooden plank that spans two images My Note Launch Vision Builder AI if it is not o
29. NI Vision NI Vision Builder for Automated Inspection Tutorial September 2011 7 NATIONAL 373379H 01 instruments Worldwide Technical Support and Product Information ni com Worldwide Offices Visit ni com niglobal to access the branch office Web sites which provide up to date contact information support phone numbers email addresses and current events National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin Texas 78759 3504 USA Tel 512 683 0100 For further support information refer to the Technical Support and Professional Services appendix To comment on National Instruments documentation refer to the National Instruments Web site at ni com info and enter the Info Code feedback 2002 2011 National Instruments Corporation All rights reserved Important Information Warranty The media on which you receive National Instruments software are warranted not to fail to execute programming instructions due to defects in materials and workmanship for a period of 90 days from date of shipment as evidenced by receipts or other documentation National Instruments will at its option repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period National Instruments does not warrant that the operation of the software shall be uninterrupted or error free A Return Material Authorization RMA number mus
30. STRUMENTS PRODUCTS WHENEVER NATIONAL INSTRUMENTS PRODUCTS ARE INCORPORATED IN A SYSTEM OR APPLICATION INCLUDING WITHOUT LIMITATION THE APPROPRIATE DESIGN PROCESS AND SAFETY LEVEL OF SUCH SYSTEM OR APPLICATION Contents About This Manual GOMVENEIONS sso ys bos Seek eS ashes BS ees E E eee ek eR is edness aed hee x Related Documentation ssssssssesesseseeetrttrrrsrssssssseseserrrtrereererrtressssssrsrttrtrttereeeeeneeesessss xi Chapter 1 Introduction to Vision Builder Al Vision Builder AI Configuration Interface sesseesseeeseessseesreesesesresrsresresrsresreseseenenes 1 4 Elements of the Configuration Interface sseessesessseesessresresrsrrsrrersresresesrrees 1 5 Inspection State Diagram ec eeeeeeeeeceeceseeseeeseceeeeaeeseeesecsecesecseeeseseseaeenees 1 6 Vision Builder AI Inspection Interface eee ee eeeeeesecesecseeeseeseesaecseeeaeeeeesseneeaes 1 8 Running an Inspection sc 2ss ieee aiii nieo aenieiai Geus aE SE REAR Saee Eoo a eao 1 9 Configuration Interface ic scctssis se ccssdeciasecsgsestsadassessssssecuessacbesescavecticereseestas 1 9 Inspection Interface yei as eas bediecl plies A o EE E AS 1 11 Chapter 2 Checking for the Presence of a Part Cr ating a New Inspection sniene E ain teed ns ES RAE AN ESTE EEE 2 1 Acquiring Inspection Images 0 0 0 0 oni A e E E N E 2 1 Defining a Feature on which to Base a Coordinate System sssssessesesesrsreersreersereerses 2 2 Setting a C
31. Two Image Frames Switching Images Now that you have configured the inspection to locate the right edge of the wooden plank you need to switch to the image of the left side of the plank Complete the following instructions to configure a Select Image step that makes the image of the left side of the plank active for processing 1 4 In the Inspection Steps palette select the Acquire Images tab Click the Select Image step The property page for the step opens In the Step Name control enter Switch to Left Side In the Image Selection list select Acquire Plank Left The image of the left side of the part appears in the Main window Click OK to add the step to the inspection Locating the Left Edge of the Part Complete the following instructions to configure a Find Edges step that locates the left edge of the part 1 2 3 4 A National Instruments Corporation In the Inspection Steps palette select the Locate Features tab Click the Find Edges step The property page for the step opens In the Step Name control enter Find Left Edge Hold down the lt Shift gt key and draw a line across the left edge of the part going from left to right as shown in Figure 5 6 Click the Settings tab In the Look for control select First Edge In the Edge Polarity control select Bright to Dark Only 5 9 NI Vision Builder for Automated Inspection Tutorial Chapter 5 Inspecting an Object that Spans Two
32. ace the Add operator close enough to the Find Right Edge Edge 1 X Position Calibrated input so that the Calculator step automatically connects the two elements with a wire te 5 Click the Show Help Window button on the Main tab of the Calculator step to launch the Help window or click the Help button in the Calculator diagram toolbar When you move your cursor over certain elements within the Calculator diagram information about that item shows in the Help window 6 Place your cursor over the Add operator Notice in the Help window that the operator has an x input terminal y input terminal and x y output terminal gt 7 Click the Subtract operator in the Functions palette Click inside the Calculator diagram to the right of the Find Left Edge Edge 1 X Position Calibrated input measurement Your Calculator diagram should look similar to the diagram shown in Figure 5 9 Find Right Edge Edge 1 Position Calibrated ight Edg geli Right LC Find Left Edge Edge 1 X Position Calibrated Part Width A gt Step Result Figure 5 9 Unconnected Diagram Elements NI Vision Builder for Automated Inspection Tutorial 5 14 ni com Chapter 5 Inspecting an Object that Spans Two Image Frames Connecting the Equation Elements Complete the following instructions to wire the diagram elements together such that they form Equation 5 1 Right LC Right RC 37 1 Place your cursor on t
33. ach image is loaded individually when the step executes 9 Click OK to add the step to the inspection Defining a Feature on which to Base a Coordinate System In a machine vision inspection you typically limit your inspection and processing to a region of interest ROI rather than the entire image for the following reasons e To improve your inspection results by avoiding extraneous objects e To increase inspection speed To limit the inspection area the parts of the object you are interested in must always be inside the ROI you define If the object under inspection is fixtured and always appears at the same location and orientation in the images you need to process defining an ROI is straightforward However if the object under inspection appears shifted or rotated within the images the regions of interest need to shift and rotate with the object under inspection For the regions of interest to move in relation to the object you need to set a coordinate system relative to a significant and original feature of the object under inspection Choose a feature that is always in the field of view of the camera despite the different locations that the objects may appear in from image to image Also make sure the feature is not affected by major defects that could drastically modify the visual appearance of the feature NI Vision Builder for Automated Inspection Tutorial 2 2 ni com Chapter 2 Checking for the Presence of a P
34. akes up a digital image For measurement tasks optimum pixel dimensions are square aspect ratio of 1 1 or the width equal to the height The number of rows and columns of pixels An image composed of m rows and n columns has a resolution of m x n Region of Interest An area of the image that is graphically selected from a window displaying the image This area can be used to focus further processing Assigning physical dimensions to the area of a pixel in an image A particular set of steps that execute under certain conditions during an inspection A graphical representation of a finite state machine A component of a Vision Builder AI inspection that performs a specific visual inspection task or supporting tasks such as decision making and serial communication Pattern that you are trying to match in an image using the Match Pattern Match Color Pattern Geometric Matching or Detect Defects steps A template can be a region selected from an image or it can be an entire image Event that causes the inspection to move from one state to another NI Vision Builder for Automated Inspection Tutorial G 2 ni com
35. ansition The Edit Transition dialog box opens NI Vision Builder for Automated Inspection Tutorial 6 12 ni com Chapter 6 Branching and Decision Making 6 In the Edit Transition dialog box modify the controls to transition when Check Cap Presence Step Status is Pass as shown in Figure 6 11 Edit Transition X Transition Name Part OK Transition will be activated when the following condition is met Measurement Check Cap Presence Step Status v is Pass O Fail Not Available Current Value Fail Figure 6 11 Configuring the Part OK Transition 7 Click OK to close the Edit Transition dialog box Testing the Inspection Test the images in the Tutorial 5 folder to make sure the inspection returns the correct results Click the Run Inspection Once button to test the remaining images Table 6 1 displays the expected results for each image Table 6 1 Expected Results for the State Diagram Branching Inspection Image Name Inspection Status Explanation Image 00480 jpg PASS Cap is present Image 01710 jpg PASS Cap is present Image 03450 jpg FAIL Cap is missing Image 04200 jpg PASS Cap is present National Instruments Corporation 6 13 NI Vision Builder for Automated Inspection Tutorial Chapter 6 Branching and Decision Making Saving the Inspection Complete the following instructions to save the example inspection 1 Select File Save or click the S
36. art Complete the following instructions to configure a Match Pattern step that locates a bottle feature on which you can base a coordinate system 1 Inthe Inspection Steps palette select the Locate Features tab 2 Click the Match Pattern step The NI Vision Template Editor opens 3 Draw a rectangle around the base of the sprayer as shown in Figure 2 1 This region becomes the pattern matching template NI Vision Template Editor Select Template Region g Xilol gt go 640x480 1 05X 8 bit image 191 621 22 gt lt lt Previous Next gt gt Finish Cancel Help Figure 2 1 Creating a Template Pattern 4 Click Next Click Finish to accept the template On the Main tab enter Locate Sprayer Base in the Step Name control National Instruments Corporation 2 3 NI Vision Builder for Automated Inspection Tutorial Chapter 2 Checking for the Presence of a Part The green ROI specifies the area of the image in which Vision Builder AI tries to locate the template Assuming that the bottles are fixtured in such a way that they can move only horizontally within the field of view you can limit the ROI so that it surrounds only the area of the image that may contain a template match during inspection 7 Redraw or decrease the default green ROI so that it surrounds only the lower portion of the image as shown in Figure 2 2 Locate Sprayer Base
37. ate diagram and configured all of the steps in the inspection you must specify when you want transitions from one state to another state to occur Complete the following sets of instructions to configure the transitions for the inspection If an image has an incorrect number of pins the inspection should transition to the Fail Inspection state Complete the following instructions to define the Wrong Pins transition Fr 1 Click the Toggle Main Window View button on the toolbar to bring x the inspection state diagram to the Main window 2 Double click the Wrong Pins transition on the state diagram to launch the Edit Transition dialog box 3 In the Edit Transition dialog box modify the controls to transition when Find Pin Edges Step Status is Fail 4 Click OK to close the dialog box Since the same inspection needs to be performed on each set of pins on the electronic component the Repeat for Next Pin transition creates a loop in the inspection that eliminates the need to configure separate steps to inspect each set of pins Complete the following instructions to configure the Repeat for Next Pin transition 1 Double click the Repeat for Next Pin transition 2 Inthe Edit Transition dialog box modify the controls to transition when Get Edge Position Remaining Objects is Greater than 1 3 Click OK to close the dialog box NI Vision Builder for Automated Inspection Tutorial 7 12 ni com The final transition that must
38. ave button on the toolbar H 2 Navigate to the location where you want to save the inspection 3 Inthe File Name control enter Tutorial 5 vbai 4 Click Save to save the inspection Tip Select File Inspection Properties to add a short description or comments about the inspection NI Vision Builder for Automated Inspection Tutorial 6 14 ni com Looping and Variables This chapter uses the inspection state diagram to implement a looping inspection and introduces the Set Variable and Index Measurements steps Follow the instructions in this chapter to create an inspection that inspects images of electronic components to determine if the distance between pins on the component is within a predetermined range If the pin is too close or too far away from an adjacent pin then the inspection fails The inspection does not need to check every pin on the microchip before failing the inspection The inspection fails at the first failed pin 3 Note Launch Vision Builder AI if it is not open Refer to the Vision Builder AI Configuration Interface section of Chapter 1 Introduction to Vision Builder AI for more information Creating a New Inspection Select File New to load a new blank Vision Builder AI inspection Creating the Inspection State Diagram Complete the following instructions to create a state diagram to define the inspection 1 Click the Toggle Main Window View button on the toolbar to bring the inspection state d
39. ave the example inspection 1 Select File Save or click the Save button on the toolbar H 2 Navigate to the location where you want to save the inspection 3 Inthe File Name control enter Tutorial 6 vbai 4 Click Save to save the inspection Y Tip Select File Inspection Properties to add a short description or comments about the inspection NI Vision Builder for Automated Inspection Tutorial 7 14 ni com Technical Support and Professional Services Visit the following sections of the award winning National Instruments Web site at ni com for technical support and professional services National Instruments Corporation Support Technical support at ni com support includes the following resources Self Help Technical Resources For answers and solutions visit ni com support for software drivers and updates a searchable KnowledgeBase product manuals step by step troubleshooting wizards thousands of example programs tutorials application notes instrument drivers and so on Registered users also receive access to the NI Discussion Forums at ni com forums NI Applications Engineers make sure every question submitted online receives an answer Standard Service Program Membership this program entitles members to direct access to NI Applications Engineers via phone and email for one to one technical support as well as exclusive access to on demand training modules via the Services Resource Center NI offers co
40. ck the Set Inspection Status step The property page for the step opens Inthe Step Name control enter Set Inspection Status In the Inspection Status control select the Set to PASS option Enable the Update Number of Parts Inspected checkbox Click OK to add the step to the inspection Displaying the Current Inspection Image Complete the following instructions to use a Display Image step to display the current inspection image 1 ail Inspection El Oy E ee BS National Instruments Corporation In the Overview Window click the Fail Inspection state on the state diagram In the Inspection Steps palette select the Use Additional Tools tab Click the Display Image step The property page for the step opens In the Step Name control enter Display Image In the Display Images control select the Always option Click OK to add the step to the inspection 7 11 NI Vision Builder for Automated Inspection Tutorial Chapter 7 Looping and Variables 7 Inthe Overview window click the Pass Inspection state on the state Pass Inspection diagram 8 Inthe Inspection Steps palette select the Use Additional Tools tab 9 Click the Display Image step The property page for the step opens 10 In the Step Name control enter Display Image 11 In the Display Images control select the Always option 12 Click OK to add the step to the inspection Configuring State Transitions After you have created the st
41. ct Center This centers the text around the point you selected using the Text tool Click OK to save the Text Properties settings and close the dialog box Click OK to add the step to the inspection Next you need to create an overlay to display if the inspection passes Complete the following steps to create an overlay to display when the inspection passes Gossea h d 2 3 4 5 2 D 10 11 12 13 14 15 16 In the Overview window click the Pass Part state on the state diagram In the Inspection Steps palette select the Use Additional Tools tab Click the Custom Overlay step The property page for the step opens In the Step Name control enter Overlay Results On the Custom Overlay tab select the Rectangle tool and draw a rectangle in the upper left corner of the image Click the Stroke control and select black Click the Fill control and select a bright green color On the Custom Overlay tab select the Text tool and click a point just below the center of the rectangle overlay In the Text control enter Part OK Click the Text color control and select black Click the Text Properties button The Text Properties dialog box appears In the Desired Font control select User Specified Font Specify a Font Name and Size to use for the overlay In the Horizontal Alignment control select Center Click OK to save the Text Properties settings and close the dialog box Click OK to add the step
42. e control and set the value to 30 00 Enable the Maximum Distance control and set the value to 46 00 Click OK to add the step to the inspection 7 9 NI Vision Builder for Automated Inspection Tutorial Chapter 7 Looping and Variables Updating the Variable After you have measured the gap between two pins you must increment the Counter variable so that the next time the state is executed the next set of pins is inspected Complete the following instructions to use a Set Variable step to increment the value of the Counter variable 1 2 In the Inspection Steps palette select the Use Additional Tools tab Click the Set Variable step The property page for the step opens in the Main window In the Step Name control enter Update Counter In the Operation control select the Increment option Click OK to add the step to the inspection Identifying Failed Pins Complete the following instructions to create an overlay to identify a failed pin using the Custom Overlay step 1 i 4 5 6 7 9 In the Inspection Steps palette select the Use Additional Tools tab Click the Custom Overlay step The property page for the step opens In the Step Name control enter Overlay Failed Gap On the Custom Overlay tab select the Indicator tool and draw a small indicator on the image In the Top Left Point control select Get Edge Position Edge i This aligns the top left point of the indicator overlay with the i
43. e page returns the lowest pixel value inside the regions of interest The backlit edges of the plastic cap appear in silhouette as dark pixels which have low pixel intensities on a bright background which has high pixel intensities Therefore when the cap is present the minimum intensity for the regions is low When the cap is not present the minimum intensity for the regions is high because the regions contain only bright background pixels 7 Enable the Minimum Intensity control Set the Maximum value to 50 00 Click OK to add the step to the inspection 9 Click the Run State Once button located in the State Configuration window 4e pmb Vision Builder AI loads the next image Image 02 jpg from the lt Vision Builder AI gt DemoImg Tutorial 1 folder and runs the previous inspection steps in the state on the new image Notice that the bottle appears closer to the left edge of the image Vision Builder AI repositions the regions of interest based on the new location of the bottle The Step Status for the image is PASS because the presence of the cap inside the regions of interest causes the Minimum Intensity value to fall within the limits you set Setting the Inspection Status Complete the following instructions to add a Set Inspection Status step to determine whether the inspection passes or fails 1 Inthe Inspection Steps palette select the Use Additional Tools tab 2 Click the Set Inspection Status step The
44. eaeensensesseeeaeesees 5 13 Connecting the Equation Element 000 0 ec eeeeseeseeseeeceeeeseeeeeeseeseeeseeeees 5 15 Making Logical PASS FAIL Decisions with the Calculator Step 5 16 Setting the Inspection Status ou ese ee teed hee etnies een nent 5 18 Testing the Inspections actin cose ctecs essaech te steesthscstnt E E EAEE nesdesutesasbersven the 5 18 Saving the Inspect iacsesssneceseve aiii i aE achossuveh E E R E E cables sears heaeeseeutete 5 19 Chapter 6 Branching and Decision Making NI Vision Builder for Automated Inspection Tutorial vi ni com Creating a New Inspection xi i cc2ic geces cael is catesieteseadapestesdscapescencssacatsasccvscssgnastysediosaseess 6 1 Creating the Inspection State Diagram eee eceeceeecseceecseceseceeeseeseesseseeeeaeeseeenees 6 1 Acquiring Inspection Images cissie vessan rare E araa aeie 6 6 Checking for a Spray Bottle in the Image sesseseseesseeesssrsrssrsresrsesrssrsresrerrsresesrrsresese 6 6 Checking for the Cap Using the Caliper cece cseceseeseesecesecseeesesseeeeeseseseeaeeeees 6 8 Setting the Inspection Status 0 ssscscasecisassesssesaeasasescestesepescsssessacsoapeveegesssnestesestdeastase 6 9 Creating Custom Overlays for Inspection 0 eee ec eeeececseceeeeseeeeecesesetseeeaeeseesseeneens 6 9 Configuring State Transitions siisi sosirii ieri siseses irae aereis AR Eii 6 11 Testing the Inspection sirian naasa aieo oaaae cb ia a a as 6 13 Saving the Inspection
45. ection Status step to determine whether the inspection passes or fails In the Inspection Steps palette click the Use Additional Tools tab Click the Set Inspection Status step The property page for the step opens In the Inspection Status control select the Set to FAIL if any previous step fails option Click OK to add the step to the inspection Creating Custom Overlays for Inspection Use the Custom Overlay step to create custom overlays that display whether the inspection passed or failed Complete the following steps to create an overlay to display when the inspection fails rapa 1 2 i 5 6 gt N National Instruments Corporation In the Overview window click the Fail Part state on the state diagram In the Inspection Steps palette select the Use Additional Tools tab Click the Custom Overlay step The property page for the step opens In the Step Name control enter Overlay Results On the Custom Overlay tab select the Text tool and click a point in the image near the bottom of the spray nozzle of the bottle In the Text Control enter Missing Cap Click the Text Properties button The Text Properties dialog box opens 6 9 NI Vision Builder for Automated Inspection Tutorial Chapter 6 Branching and Decision Making 10 11 12 In the Desired Font control select User Specified Font Specify a Font Name and Size to use for the overlay In the Horizontal Alignment control sele
46. ection fails at the first failed pin gt Gh bold italic monospace The following conventions appear in this manual The symbol leads you through nested menu items and dialog box options to a final action The sequence Options Settings General directs you to pull down the Options menu select the Settings item and select General from the last dialog box This icon denotes a tip which alerts you to advisory information This icon denotes a note which alerts you to important information This icon denotes a caution which advises you of precautions to take to avoid injury data loss or a system crash Bold text denotes items that you must select or click in the software such as menu items and dialog box options Bold text also denotes parameter names Italic text denotes variables emphasis a cross reference or an introduction to a key concept Italic text also denotes text that is a placeholder for a word or value that you must supply Text in this font denotes text or characters that you should enter from the keyboard sections of code programming examples and syntax examples This font is also used for the proper names of disk drives paths directories programs subprograms subroutines device names functions operations variables filenames and extensions NI Vision Builder for Automated Inspection Tutorial X ni com About This Manual Related Documentation The following documents conta
47. er Images control is enabled so that Vision Builder AI loads a different simulation image from the folder each time the step is run 9 Click OK to add the step to the inspection Finding Pin Edges Complete the following instructions to configure a Find Edges step to find the edges of the pins and determine if the microchip has the correct number of pins 1 In the Inspection Steps palette select the Locate Features tab 2 Click the Find Edges step The property page for the step opens 3 Inthe Step Name control enter Find Pin Edges NI Vision Builder for Automated Inspection Tutorial 7 6 ni com 4 Chapter 7 Looping and Variables Hold down the lt Shift gt key and draw a line from left to right across the width of the image where the pins are located as shown in Figure 7 6 Figure 7 6 Locating the Edges of the Pins of a Microchip In the Look for control select All Edges In the Edge Polarity control select Bright to Dark Only On the Limits tab enable the Minimum Number of Edges control and set the value to 7 Enable the Maximum Number of Edges control and set the value to 7 Click OK to add the step to the inspection Initializing the Variable Use the Set Variable step to set the value of user defined variables Complete the following instructions to configure a Set Variable step to initialize the Counter variable 1 2 National Instruments Corporation In the Inspection S
48. ern step you configured 1 Inthe Inspection Steps palette select the Locate Features tab 2 Click the Set Coordinate System step The property page for the step da opens 3 On the Main tab enter Coordinate System in the Step Name control e 4 On the Settings tab select Horizontal and Vertical Motion from the t Mode control because the bottles appear shifted but not rotated from one image to another Notice the Origin list Match 1 the match location of the previous Locate Sprayer Base step is the default origin of the coordinate system because it is the only location point created by previous steps in the inspection 5 Click OK to add the step to the inspection Checking for the Cap Using Measure Intensity The image of the spray bottle was acquired using a backlight The cap appears dark on the bright background Complete the following instructions to configure a Measure Intensity step to check for the presence of a spray bottle cap 1 In the Inspection Steps palette select the Measure Features tab 2 Click the Measure Intensity step The property page for the step opens 3 On the Main tab enter Check Cap Presence in the Step Name control 4 Enable the Reposition Region of Interest control Enabling this control allows you to link the regions of interest specified in this step to a previously defined coordinate system so that Vision Builder AI can adjust the location and orientation of the ROI from
49. ess the steps contained in a state select the state on the state diagram The steps present in the state will appear in the State Configuration window The currently selected state is highlighted on the state diagram Chapter 6 Branching and Decision Making and Chapter 7 Looping and Variables provide examples of using the state diagram National Instruments Corporation 1 7 NI Vision Builder for Automated Inspection Tutorial Chapter 1 Introduction to Vision Builder Al Vision Builder Al Inspection Interface As mentioned in the Vision Builder AI Configuration Interface section of this chapter use the Vision Builder AI built in Inspection Interface to deploy and run an inspection Figure 1 6 shows the built in Inspection interface which has three main areas the Results panel the Inspection Statistics panel and the Display window NI Vision Builder Al Inspection Tutorial 3 Decision Making vbai Wee Inspection View Options Help r S pju PPR m Yield 63 24 Pass 129 H Fal 75 H Active vs Idle Time s Active 10 2 H sane O BB ise Idle 1 9 Parts s 17 39 x 640x480 1X Distribution of processing time Display All Images Enabled for the last 100 inspection states wy 80 Inspection States Steps Result Measure Comment la 3 e04 a Inspect Acquire Fuse Image 04 jpg gt E Locate Fuse Left Edge Distance 41 85 reece 3 410 7 Set Coordinate System 8 20
50. f the NI 17xx smart camera troubleshooting guidelines and information about the LEDs DIP switches and connectors on the NI 17xx NI 177x Smart Camera User Manual Describes the electrical and mechanical aspects of the NI 177x smart camera and information about the LEDs and connectors on the NI 177x NI CVS 1450 Series User Manual Describes the electrical and mechanical aspects of the NI CVS 1450 Series troubleshooting guidelines and information about the LEDs DIP switches and connectors on the CVS 1450 device NI EVS 1464 User Manual Describes the electrical and mechanical aspects of the NI EVS 1464 embedded vision system troubleshooting guidelines and information about the LEDs DIP switches and connectors on the EVS 1464 device xi NI Vision Builder for Automated Inspection Tutorial About This Manual e NI Smart Camera I O Accessory User Guide Describes the features of the NI Smart Camera I O Accessory what you need to get started and the installation and operation of the device e NI Vision Concepts Help Describes the basic concepts of image analysis image processing and machine vision This document also contains in depth discussions about imaging algorithms for advanced users The MI Vision Concepts Help is available by selecting Start All Programs National Instruments Vision Builder Al Documentation NI Vision Concepts Help from the Start menu NI Vision Builder for Automated Inspection Tutorial x
51. for scaling in only one direction Click Next to define values for the Y axis I Specify a different scale for the Y axis Select 2 points by clicking the image then define the distance between the points in real world units Select the point in the list to adjust X and Y coordinates Points E M 1 User Point 1 M 2 User Point 2 1 2 43 640x480 1X 78 106 i 2 PPRT Figure 5 1 Defining the Pixel to Real World Ratio 15 In the Distances control enter 4 for the Real World value and select centimeter for the Unit 16 Click Next 17 Ignore the Compute Lens Distortion Model option and click Next National Instruments Corporation 5 3 NI Vision Builder for Automated Inspection Tutorial Chapter 5 Inspecting an Object that Spans Two Image Frames 18 In the Specify Calibration Axis step click the 1 cm marking to define it as the origin of the calibration axis Draw a line horizontally and to the right along the edge of the ruler to define the angle of the calibration axis as shown in Figure 5 2 640x480 1X 376 0 PIPIRI Ta 19 20 21 22 I NI Calibration Training Interface Calibrate Plank Left 2 ZS Step 3 Specify Calibration Axis Select the origin of the calibration axis and the angle of the X axis relative to the horizontal axis of the image You can draw a line in the image to specify the origin and X axis angle Axis Origin x Y Ax
52. h correspond to the bottom small hole and large hole respectively 8 Inthe Limits tab enable the Minimum Distance control and set it to 38 Enable the Maximum Distance control and set it to 40 9 Click OK to add the step to the inspection Setting the Inspection Status Complete the following instructions to add a Set Inspection Status step to determine whether the inspection passes or fails 1 Inthe Inspection Steps palette select the Use Additional Tools tab 2 Click the Set Inspection Status step The property page for the step opens 3 Inthe Inspection Status control select the Set to FAIL if any previous step fails option 4 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 run the inspection on each of the test images Table 3 2 lists the test images the inspection status to expect for each image and an explanation of the status Table 3 2 Expected Results for the Gasket Inspection Image Name Inspection Status Explanation Image 01 jpg PASS All steps passed Image 02 jpg PASS All steps passed Image 03 jpg PASS All steps passed Image 04 jpg FAIL The Top Distance step failed because the distance between the holes is too small Image 05 jpg FAIL The Detect Small Holes step failed because the bottom hole is missing The missing hole also caused the Bott
53. he Logic Calculator property page should resemble Figure 4 6 Step Name Decide Pass Fail Operands First Operand Second Operand Source Match Conductor 2 s Constant True m Operator Measure Step Status v O Source v Current Value Pass Result Measure v Current Value Expression First Operand NOT Operator Second Operand Result AND OR j AND OR Measure Separation Step Status TRUE AND Match Conductor 1 Step Status TRUE OR Match Conductor 2 Step Status TRUE True 0 y Logic Result _ TRUE Mode Step passes inspection when Logic Result is TRUE Step Status Step passes inspection if the Expression can be evaluated i e all necessary results PASS are available The Logic Result is logged as a boolean measurement that can be used in future steps Figure 4 6 Logic Calculator Property Page 16 Click OK to add the step to the inspection National Instruments Corporation 4 9 NI Vision Builder for Automated Inspection Tutorial Chapter 4 Inspecting for Multiple Correct Instances of an Object 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 Inthe Inspection Steps palette select the Use Additional Tools tab 2 Click the Set Inspection Status step The property page for the step Ue opens 3 Inthe
54. he small triangular terminal located on the right side of the numeric constant The cursor changes into a Wiring tool Use the Wiring tool to click the terminal and release the mouse As you move the cursor across the Calculator diagram the Calculator step draws a wire between the terminal and the Wiring tool as though the wire were unwinding from a spool Without holding down the mouse button move the cursor to the y input terminal of the Add operator The y input terminal blinks Use the Wiring tool to click the y input terminal and complete the connection Click the output terminal of the Add operator and connect it to the input terminal of Right LC Y Tip If you do not terminate a wire correctly the wire is broken and appears as a dashed black line with a red X in the middle Click Remove Broken Wires in the Main tab to remove broken wires Complete the following instructions to wire the diagram elements together such that they form Equation 5 2 Part Width Right LC Left LC 1 National Instruments Corporation Place the cursor on the wire that connects the Add operator to Right LC The cursor changes into the Wiring tool Click the wire and connect it to the x input terminal of the Subtract operator Click the Find Left Edge Edge 1 X Position Calibrated output terminal and connect it to the y input terminal of the Subtract operator Click the output terminal of the Subtract operator and connec
55. iagram to the Main window 2 Double click the Inspect state to launch the Edit State Name dialog box 3 Inthe State Name control enter Acquire Image amp Find Pin Edges National Instruments Corporation 7 1 NI Vision Builder for Automated Inspection Tutorial Chapter 7 Looping and Variables 4 Right click an open area on the state diagram and select Create New State to add a new state to the inspection as shown in Figure 7 1 The Edit State Name dialog box opens Start default Acquire Image amp Find Pin Edges fh OMe New State default Create New End Point End Import Inspection Figure 7 1 Creating a New Inspection State In the State Name control enter Check Pin Gap 6 Create two more states named Fail Inspection and Pass Inspection The state diagram should now resemble the state diagram shown in Figure 7 2 Start default Acquire I Gn Fan Edges default End famy default default Pheer default Figure 7 2 Adding New States to the Inspection NI Vision Builder for Automated Inspection Tutorial 7 2 ni com Chapter 7 Looping and Variables Next you will define transitions between the various inspection states Notice that every state has a default transition You can also create additional transitions between states based on measurement results or variable values ay Note The default transition occurs if the transition requirements for other possible transitio
56. ii ni com Introduction to Vision Builder Al This chapter introduces the Vision Builder AI environment and describes how to run an inspection Figures 1 1 and 1 2 show general instructions for creating a Vision Builder AI inspection Figure 1 1 describes the basic steps for designing a Vision Builder AI inspection The Add Inspection Steps module of Figure 1 1 is expanded in Figure 1 2 National Instruments Corporation 1 1 NI Vision Builder for Automated Inspection Tutorial Chapter 1 Introduction to Vision Builder Al Open Vision Builder Al Configuration interface Add step to acquire an image of the parts under inspection Do you want to make measurements in real world units Create or select a spatial calibration from the Calibration tab of the acquisition step Do the parts appear in different locations from image to image Add step from Locate Features palette to locate the part in the image Add Set Coordinate System step to create a coordinate system based on the part location Add Inspection steps f roe to Figure 1 2 for details Do you want to create intermediate measurements based on the results of previous steps Yes Add Calculator step Do you want to customize the inspection decision Add Logic Calculator step or Calculator step Add Set Inspection Status step Do you want to send
57. image to image relative to the specified coordinate system The Reference Coordinate System list shows all the previously defined coordinate systems Coordinate System is the default reference coordinate system because it is the only Set Coordinate System step in the current inspection NI Vision Builder for Automated Inspection Tutorial 2 6 ni com National Instruments Corporation Chapter 2 Checking for the Presence of a Part Notice that the Measure Intensity step supports a variety of different tools that enable you to draw different shaped regions of interest such as a point line broken line freehand line rectangle ellipse annulus polygon and freehand region These tools are available in the main menu bar Using the default Rectangle Tool hold down the lt Ctrl gt key and draw three regions of interest that enclose edges of the cap as shown in Figure 2 4 Pressing the lt Ctrl gt key enables you to draw multiple regions of interest for the step Check Cap Presence Figure 2 4 Defining Regions in Which to Measure Intensity Click the Limits tab At the bottom of the Limits tab Vision Builder AI returns the intensity statistics of the pixels inside the regions of interest Pixel intensities can range from 0 255 where 0 equals black and 255 equals white 2 7 NI Vision Builder for Automated Inspection Tutorial Chapter 2 Checking for the Presence of a Part The Minimum Intensity value at the bottom of th
58. in information that you might find helpful as you read this manual National Instruments Corporation NI Vision Builder for Automated Inspection Readme Contains information about the minimum system requirements installation instructions device support and known issues for NI Vision Builder for Automated Inspection The MI Vision Builder for Automated Inspection Readme is available at Start All Programs National Instruments Vision Builder Al Documentation NI Vision Builder for Automated Inspection Configuration Help Contains information about using the Vision Builder AI Configuration interface to create a machine vision application NI Vision Builder for Automated Inspection Configuration Help is available by selecting Help Online Help from the Vision Builder AI Configuration interface NI Vision Builder for Automated Inspection Inspection Help Contains information about running applications created using Vision Builder AI in the Vision Builder AI Inspection Interface NI Vision Builder for Automated Inspection Inspection Help is available by selecting Help Online Help from the Vision Builder AI Inspection interface NI Developer Zone Visit ni com zone for the latest example programs tutorials technical presentations and a community area where you can share ideas questions and source code with developers around the world NI 17xx Smart Camera User Manual Describes the electrical and mechanical aspects o
59. is Angle Angle Value X Axis Angle degrees X Axis Point X Axis Point x Axis Reference B Figure 5 2 Defining the Origin and Angle of the Calibration Axis Set the Axis Reference control to Direct Click Next Click OK to learn the calibration information and exit the calibration training interface Click OK to add the step to the inspection NI Vision Builder for Automated Inspection Tutorial 5 4 ni com Chapter 5 Inspecting an Object that Spans Two Image Frames Acquiring and Calibrating the Image of the Right Edge lv ie This section simulates acquiring an image of the right section of the wooden plank Because the simulated acquisition represents a second camera you cannot reuse the calibration that you created for the first camera Complete the following instructions to configure Simulate Acquisition steps that simulate acquiring an image of the right section of the wooden plank and calibrating the image 1 Inthe Inspection Steps palette select the Acquire Images tab 2 Click the Simulate Acquisition step The property page for the step opens In the Step Name control enter Acquire Plank Right 4 Click the Browse button The Select an Image File dialog box opens Navigate to lt Vision Builder AI gt DemoImg Tutorial 4 Right where lt Vision Builder AI gt is the location where Vision Builder AI is installed Select the first image Image 01 jpg and click Open Make sure the Cycle Through
60. itial Value control enter 1 Click OK to create the variable Click OK to close the Variable Manager 7 5 NI Vision Builder for Automated Inspection Tutorial Chapter 7 Looping and Variables Acquiring Inspection Images For simplicity this tutorial instructs you to use the Simulate Acquisition step However in your real world inspection use one of the other image acquisition steps to acquire images of the object under inspection Complete the following instructions to configure a Simulate Acquisition step that simulates acquiring images of the pins on electronic components 1 On the state diagram select the Acquire Image amp Find Pin Edges Acquire Image amp Find Pin Edges ate state 2 Inthe Inspection Steps palette select the Acquire Images tab 3 Click the Simulate Acquisition step The property page for the step t opens AA Note When the property page for an inspection step opens if the state diagram is displayed in the Main window the state diagram switches from the Main window to the Overview window to allow you to use the current inspection image to configure the step 4 Inthe Step Name control enter Acquire Pins 5 Click the Browse button The Select an Image File dialog box opens 6 Navigate to lt Vision Builder AI gt DemoImg Tutorial 6 where lt Vision Builder AI gt is the location where Vision Builder AI is installed 7 Select image 01 jpg and click Open Make sure the Cycle Through Fold
61. ition step which simulates image acquisition by loading images from file The Select Image step enables you to switch to a previously acquired image that you need to process later in the inspection For simplicity this tutorial instructs you to use the Simulate Acquisition step However in your real world inspection use one of the other image acquisition steps to acquire images of the object under inspection Complete the following instructions to configure a Simulate Acquisition step that simulates acquiring images of spray bottles 1 Inthe Inspection Steps palette select the Acquire Images tab 2 Click the Simulate Acquisition step The property page for the step opens 3 Inthe Step Name control enter Acquire Spray Bottle National Instruments Corporation 2 1 NI Vision Builder for Automated Inspection Tutorial Chapter 2 Checking for the Presence of a Part 4 Click the Browse button The Select an Image File dialog box opens Navigate to lt Vision Builder AI gt DemoImg Tutorial 1 where lt Vision Builder AI gt is the location where Vision Builder AI is installed 6 Select the first image Image 01 Jpg and click Open 7 Make sure the Cycle Through Folder Images control is enabled so that Vision Builder AI loads a different simulation image from the folder each time the step is run 8 Enable the Cache Images control if you want to load all of the images into memory when the inspection opens By default e
62. lder AI loads a different simulation image from the folder each time the step is run Click the Calibration tab 9 Click Create Calibration to launch the calibration training interface 10 In the Calibration Name control enter Plank Calibration Left 11 Click Next For this example assume that the camera that acquired the inspection images is perpendicular to the image plane and lens distortion is negligible Based on these assumptions you can use Point Distance Calibration to calibrate your images Point Distance Calibration transforms a pixel coordinate to a real world coordinate through scaling in the x horizontal and y vertical directions 12 Select the Point Distance Calibration option and click Next 13 Make sure that the current image is selected and click Next NI Vision Builder for Automated Inspection Tutorial 5 2 ni com Chapter 5 Inspecting an Object that Spans Two Image Frames 14 Carefully click the 0 mm and 50 mm markings on the ruler at the bottom of the image as shown in Figure 5 1 Tip You may need to use the zoom buttons below the image to accurately click the ruler markings After zooming in scroll down to see the ruler at the bottom of the image eT j NI Calibration SU NI Calibration Training Interface Untitledd j Interface Untitled 1 Step 4 Specify Real World Distances Specify a different scale for the Y axis if your sensor has rectangular pixels or if you want to account
63. le 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 ay Note The name of the active image is displayed in the Acquire Fuse step in the State Configuration window NI Vision Builder for Automated Inspection Tutorial 4 6 ni com Chapter 4 Inspecting for Multiple Correct Instances of an Object A fuse may be inverted when Vision Builder AI acquires an image of the fuse This inversion causes the conductor to look different than the template shown in Figure 4 5a 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 Figure 4 5b 21 22 23 24 25 National Instruments Corporation Figure 4 5 Valid Templates for the Conductor In the Inspection Steps palette select the Locate Features tab Click the Match Pattern step The Select a template in the image dialog box opens Draw an ROI around the conductor similar to the region you drew in step 3 Click OK to learn the inverted template Inthe Step Name control enter Match Conductor 2 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
64. lick Open Make sure the Cycle Through Folder Images control is enabled so that Vision Builder AI loads a different simulation image from the folder each time the step is run Click OK to add the step to the inspection Checking for a Spray Bottle in the Image Complete the following instructions to configure a Match Pattern step to check for the presence of a spray bottle in the image 1 2 4 In the Inspection Steps palette select the Locate Features tab Click the Match Pattern step The NI Vision Template Editor opens Draw a region of interest ROI around the bottom left edge of the bottle This region becomes the pattern matching template Click Next NI Vision Builder for Automated Inspection Tutorial 6 6 ni com Chapter 6 Branching and Decision Making Click Finish to accept the template On the Main tab enter Locate Bottle in the Step Name control Adjust the default green ROI so that it only surrounds the area of the image that could contain the bottom left edge of a spray bottle as shown in Figure 6 7 Locate Bottle Figure 6 7 Adjusting the Search Region On the Settings tab set the Number of Matches to Find control to 1 On the Limits tab enable the Minimum Number of Matches control and set the value to 1 10 Click OK to add the step to the inspection National Instruments Corporation 6 7 NI Vision Builder for Automated Inspection Tutorial Chapter 6 Branching and Decision Making
65. mplementary membership for a full year after purchase after which you may renew to continue your benefits For information about other technical support options in your area visit ni com services or contact your local office at ni com contact Training and Certification Visit ni com training for self paced training eLearning virtual classrooms interactive CDs and Certification program information You also can register for instructor led hands on courses at locations around the world System Integration If you have time constraints limited in house technical resources or other project challenges National Instruments Alliance Partner members can help To learn more call your local NI office or visit ni com alliance A 1 NI Vision Builder for Automated Inspection Tutorial Appendix A Technical Support and Professional Services If you searched ni com and could not find the answers you need contact your local office or NI corporate headquarters Phone numbers for our worldwide offices are listed at the front of this manual You also can visit the Worldwide Offices section of ni com niglobal to access the branch office Web sites which provide up to date contact information support phone numbers email addresses and current events NI Vision Builder for Automated Inspection Tutorial A 2 ni com Glossary C coordinate system D data type F field of view focal point inspection intensity ma
66. n step However in your real world inspection use one of the other image acquisition steps to acquire images of the object under inspection Complete the following instructions to configure a Simulate Acquisition step that simulates acquiring images of fuses 1 Inthe Inspection Steps palette select the Acquire Images tab 2 Click the Simulate Acquisition step The property page for the step opens In the Step Name control enter Acquire Fuse Click the Browse button The Select an Image File dialog box opens e e Navigate to lt Vision Builder AI gt DemoImg Tutorial 3 where lt Vision Builder AI gt is the location where Vision Builder AI is installed 6 Select the first image Image 01 jpg and click Open National Instruments Corporation 4 1 NI Vision Builder for Automated Inspection Tutorial Chapter 4 Inspecting for Multiple Correct Instances of an Object 7 Make sure the Cycle Through Folder Images control is enabled so that Vision Builder AI loads a different simulation image from the folder each time the step is run 8 Click OK to add the step to the inspection 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
67. nate System ncssa ee ie a a ieii 4 3 Measuring the Separation between COnnectors ssssseseerssesresesresrsresreetsrestssrereererestes 4 3 Inspecting the Fuse Conductor iie renar oieee E NTE ENEE e Ee eaa K EARN 4 5 Making Logical PASS FAIL Decisions ssseseeessesssreeresesrsrsrestestsresterrsrentsersreersrese 4 8 Setting the Inspection Status irs oeer aanraai 4 10 L sting the Inspection a E e E coda atisses aay A seen eye 4 10 Saving the INspeCtiOn sei sz sede desley segheectss stevie see a O tae etre eet 4 11 Chapter 5 Inspecting an Object that Spans Two Image Frames Creating al New Inspection ii ccsceasests dee cavecsevess cosesetessevessanveca ERE Rai Eaa 5 1 Acquiring Inspection Images from Two Cameras eeeeeeeseeseesseeseeeseeseeeeeseeneenaes 5 1 Acquiring and Calibrating the Image of the Left Edge ee 5 2 Acquiring and Calibrating the Image of the Right Edge oe 5 5 Locating the Right Edge of the Part eee ee ceceseceeeeeceeeeseeseeeseseeeeaecseesaesseeeaes 5 7 Switching Mages arsena rrea oa E Eea EEA EEEE vata sadvonpscateges a audevevscpavieus 5 9 Locating the Left Edge of the Part 0 eee ceeeseeeeeeeceeesseeseeesecseeeaecaeenaeeeenaes 5 9 Calculating the Width of the Part 0 eee eseeseeesecseeeseeseeeaecsesesesseensesessseeseesaees 5 11 Setting Calculator Step Inputs and Outputs 00 el eee cee eee eeeeeeeceeeeeeeeees 5 11 Adding Operators and Constants 00 0 0 cies eseseceseeseeeeeeeeeseesee
68. nate 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 4 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 National Instruments Corporation 4 3 NI Vision Builder for Automated Inspection Tutorial Chapter 4 Inspecting for Multiple Correct Instances of an Object 5 Draw an ROI across the blade connectors as shown in Figure 4 2 Figure 4 2 Measuring the Distance Between Two Edges x 6 Inthe Settings tab select the Process named Vertical Min Caliper to change the direction and orientation of the caliper search lines 7 Inthe 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 NI Vision Builder for Automated Inspection Tutorial 4 4 ni com Chapter 4 Inspecting for Multiple Correct Instances of an Object Inspecting the Fuse Conductor Complete the
69. nce feature on the part and other features in the image Setting the origin of the calibration axis to the location of the reference feature simplifies making measurements because the starting point for the measurements becomes 0 18 Click Next National Instruments Corporation 3 3 NI Vision Builder for Automated Inspection Tutorial Chapter 3 Inspecting Objects for Correct Measurements 19 Click OK to learn the calibration information and exit the calibration training interface 20 Click OK to add the step to the inspection Vision Builder AI saves the calibration in the following locations e Windows XP Server 2003 R2 32 bit c Documents and Settings All Users Application Data National Instruments Vision Builder AI Calibration e Windows 7 Vista Server 2008 R2 c ProgramData National Instruments Vision Builder AI Calibration Tip You can apply the learned calibration to all images acquired with the same camera at the same resolution Locating Features to Measure Complete the following instructions to configure a Detect Objects step that finds small holes in the gasket 1 In the Inspection Steps palette select the Check for Presence tab OC 2 Click the Detect Objects step The property page for the step opens e3 3 Inthe Step Name control enter Detect Small Holes NI Vision Builder for Automated Inspection Tutorial 3 4 ni com Chapter 3 Inspecting Objects for Correct Measurements 4 Using the defa
70. nchor point for the transition The anchor point allows you to draw an arc instead of a straight line to represent the transition 14 15 16 17 Double click the transition to launch the Edit Transition dialog box In the Transition Name control enter wrong Pins and click OK Create a transition from the Check Pin Gap state that loops back to the Check Pin Gap state named Repeat for Next Pin Create a transition named Failed between the Check Pin Gap and Fail Inspection states NI Vision Builder for Automated Inspection Tutorial 7 4 ni com Chapter 7 Looping and Variables The state diagram should now resemble the state diagram shown in Figure 7 5 Start default age amp Find Pin Edges Acquire I Wrong Pins Figure 7 5 Completed State Diagram for the Inspection Creating a Variable Since the same inspection needs to be performed on each set of pins creating a loop in the inspection eliminates the need to configure separate steps to inspect each set of pins Use the Variable Manager to configure a variable to keep track of the number of times the loop executes 1 2 SA Oe ee National Instruments Corporation Select Tools Variable Manager to launch the Variable Manager On the Inspection Variables tab of the Variable Manager click Add to launch the Add Inspection Variable dialog box In the Name control enter Counter In the Type control select Numeric In the In
71. nossas hades tepesdsdas das debates sesesdaves sebdevs desde sescajecaepessanastysnssssevtese 6 14 Contents Chapter 7 Looping and Variables Creating a New Inspection siscs scsitssesesteecsesscstepessdbestoecseduesuqessteseasigtasteetbus Eiin 7 1 Creating the Inspection State Diagram eee eee eeceesceeeeseceeeeseeesecseeesecseeeaesseenaeesees 7 1 Creating a Variablei it che Sats a E e tdi in Rl Sitka tan 7 5 Acquiring Inspection Images notorie een e Eaa e NNR E 7 6 Finding Pin Ed 9 eS seis icditss sects dete uetaeeel el eae at hn Bek a eH A oa 7 6 Titahing th Variable sivecececs socessdens testwciss eats a E E 7 7 Indexing Measurement eniinn Mini E ee Aa ee SE 7 8 Settine a Coordinate Syste neekeri neasa E EE EE E E ETE EE E EEEE RNEER HORE 7 8 Checking the Pin Gap sirens anea a ei E eh aii Wee ee 7 9 Updating the Variable 2 5 48 eats ected eet te E eae 7 10 Identifying Failed Pinson al asi seh Ae e ABSA ae a a N E EA Rates 7 10 Setting the Inspection Stats sesos o roerne aieas rE A E EEE E EEA EAE TRS 7 11 Displaying the Current Inspection Image eseeseeeeseerssesrsresesrerrstsresresrsresreresresresrsrsees 7 11 Conhieuring State Transitions enres norisoten a a a a 7 12 Testing the Inspection rori e a E O a S e aE 7 13 Saving the Inspection hrnou irn cece ses EEK E RE EEEE abe ENESELE EROR 7 14 Appendix A Technical Support and Professional Services Glossary National Instruments Corporation vii NI Vi
72. ns are not met 7 Click the Acquire Image amp Find Pin Edges default transition and drag it to the Check Pin Gap state Click the End point and drag it to the bottom of the state diagram 9 Click the Check Pin Gap state default transition and drag it to the Pass Inspection state 10 Click the Fail Inspection default transition and drag it to the End point 11 Click the Pass Inspection default transition and drag it to the End point The state diagram should now resemble the state diagram shown in Figure 7 3 Start default age amp Find Pin Edges default Acquire I End Figure 7 3 Configuring the Default Transitions 12 Right click the Acquire Image amp Find Pin Edges state and select Create New Transition National Instruments Corporation 7 3 NI Vision Builder for Automated Inspection Tutorial Chapter 7 Looping and Variables 13 Click the Fail Inspection state to create a transition between the Acquire Image amp Find Pin Edges state and the Fail Inspection state as shown in Figure 7 4 Acquire I age amp Find Pin Edges default Figure 7 4 Creating a New Transition You can change the shape of the transition by dragging the anchor point at the center of the transition You can move the location of the transition label by clicking the label and dragging it to the new location Tip When drawing a transition click once on the state diagram to set the a
73. o long FAIL NI Vision Builder for Automated Inspection Tutorial 5 18 ni com Chapter 5 Inspecting an Object that Spans Two Image Frames Saving the Inspection Complete the following instructions to save the example inspection Cae Select File Save or click the Save button on the toolbar 2 Navigate to the location where you want to save the inspection 3 Inthe File Name control enter Tutorial 4 vbai 4 Click Save to save the inspection Q Tip Select File Inspection Properties to add a short description or comments about the inspection National Instruments Corporation 5 19 NI Vision Builder for Automated Inspection Tutorial Branching and Decision Making This chapter introduces the inspection state diagram and the Custom Overlay step Follow the instructions in this chapter to create an inspection that checks the image for the presence of a spray bottle and if a bottle is present transitions to another state to determine if the bottle has a cap If there is no spray bottle present in the image the inspection moves on to the next image Note Launch Vision Builder AI if it is not open Refer to the Vision Builder AI Configuration Interface section of Chapter 1 Introduction to Vision Builder AI for more information Creating a New Inspection Select File New to load a new blank Vision Builder AI inspection Creating the Inspection State Diagram The configurable process model
74. om Distance step to fail NI Vision Builder for Automated Inspection Tutorial 3 8 ni com Chapter 3 Inspecting Objects for Correct Measurements Saving the Inspection Complete the following instructions to save the example inspection H 1 Select File Save or click the Save button on the toolbar 2 Navigate to the location where you want to save the inspection 3 Inthe File Name control enter Tutorial 2 vbai 4 Click Save to save the inspection Y Tip Select File Inspection Properties to add a short description or comments about the inspection National Instruments Corporation 3 9 NI Vision Builder for Automated Inspection Tutorial Inspecting for Multiple Correct Instances of an Object This chapter introduces the Find Straight Edge Caliper and Decision Making steps Follow the instructions in this chapter to create an inspection that measures the distance between the blade connectors of a fuse and checks the integrity of the fuse conductor regardless of the fuse position or whether the fuse is inverted 3 Note Launch Vision Builder AI if it is not open Refer to the Vision Builder AI Configuration Interface section of Chapter 1 Introduction to Vision Builder AI for more information Creating a New Inspection Select File New to load a new blank Vision Builder AI inspection Acquiring Inspection Images For simplicity this tutorial instructs you to use the Simulate Acquisitio
75. on Builder AI Configuration interface 1 Select Start All Programs National Instruments Vision Builder AI to launch Vision Builder AI 3 Note By default My Computer is selected in the list of targets When My Computer is selected Vision Builder AI runs on the development computer 2 On the Vision Builder AI welcome screen click New Inspection to open the Vision Builder AI Configuration Interface NI Vision Builder for Automated Inspection Tutorial 1 4 ni com Chapter 1 Introduction to Vision Builder Al Elements of the Configuration Interface Figure 1 3 shows the Vision Builder AI Configuration interface The Configuration interface contains four areas Main window Overview window Inspection Steps palette and State Configuration window File Edit View Operate Tools Help NI Vision Builder Al Configuration Tutorial 3 Decision Making vbai ogn Yo md pa Sieln e Bx A m Is gt D e OL i img A Acquire Image Acquires an image from the selected camera and image acquisition board Acquire Image 1394 GigE or USB Acquires an image from the selected IEEE 1394 Gigabit Ethernet USB or IP camera Read Write Camera Attributes Read and write attributes from the selected IEEE 1394 Gigabit Ethernet or USB camera Acquire Image IEEE 1394 Acquires an image from the selected IEEE 1394 camera
76. on data By default Vision Builder AI displays all the inspection images in the Display window You can change the display settings in the View menu to view only images that fail or to have no display You also can change the magnification of the displayed images in the Options menu Notice the performance data displayed in the Inspection Statistics panel This data can help you determine how efficiently your inspection is running Based on this data you can make adjustments to improve the inspection speed Click the Stop Inspection button to stop the inspection 1 11 NI Vision Builder for Automated Inspection Tutorial Checking for the Presence of a Part This chapter introduces the Match Pattern Measure Intensity and Set Coordinate System steps Follow the instructions in this chapter to create an inspection that checks for the presence of a spray bottle cap regardless of the bottle position in the inspection images 3 Note Launch Vision Builder AI if it is not open Refer to the Vision Builder AI Configuration Interface section of Chapter 1 Introduction to Vision Builder AI for more information Creating a New Inspection Select File New to load a new blank Vision Builder AI inspection Acquiring Inspection Images In the Inspection Steps palette the Acquire Images tab contains several acquisition steps you can use to acquire images from many different types of cameras The tab also contains a Simulate Acquis
77. onal Instruments corporate logo and the Eagle logo are trademarks of National Instruments Corporation Refer to the Trademark Information at ni com trademarks for other National Instruments trademarks Other product and company names mentioned herein are trademarks or trade names of their respective companies Members of the National Instruments Alliance Partner Program are business entities independent from National Instruments and have no agency partnership or joint venture relationship with National Instruments Patents For patents covering National Instruments products technology refer to the appropriate location Help Patents in your software the patents txt file on your media or the National Instruments Patent Notice at ni com patents Export Compliance Information Refer to the Export Compliance Information at ni com 1legal export compliance for the National Instruments global trade compliance policy and how to obtain relevant HTS codes ECCNs and other import export data WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS 1 NATIONAL INSTRUMENTS PRODUCTS ARE NOT DESIGNED WITH COMPONENTS AND TESTING FOR A LEVEL OF RELIABILITY SUITABLE FOR USE IN OR IN CONNECTION WITH SURGICAL IMPLANTS OR AS CRITICAL COMPONENTS IN ANY LIFE SUPPORT SYSTEMS WHOSE FAILURE TO PERFORM CAN REASONABLY BE EXPECTED TO CAUSE SIGNIFICANT INJURY TO A HUMAN 2 IN ANY APPLICATION INCLUDING THE ABOVE RELIABILITY OF OPERATION OF THE SOFTWARE PRODUCTS
78. oordinate Systeri rosera Ei iie ai a E E ER AER 2 6 Checking for the Cap Using Measure Intensity es esesseesessseeestsressssesresrsresrsresersrseeses 2 6 Setting the Inspection Status yanri a een e aE tudes seek EE E E Pai ae 2 8 Testing the Inspectton si oenn e p A a a 2 9 Saving the Inspection rnern eA esos EEEE E AEE EE EEE EE EEEE REA E Ae 2 9 Chapter 3 Inspecting Objects for Correct Measurements Creating a New Inspection isasnerin s e E EE E ER E AEAT a ERES 3 1 Acquiring and Calibrating Inspection Images sesseesssessserssressrrsresreresresrsresresesersesses 3 1 Locating Features to Measure icicccissecscsenscassscscovevecosnesevdececaeesntsvschossetecotaiveracsecaseveoeeses 3 4 Measuring Parts of the Gasket cies ec eien e E E EEA EE 3 7 Setting the Inspection Statusen ins a a Eaa A E R 3 8 Testne th Inspection semoirs ts a EA EEE EEA EE Dene 3 8 Saving the Inspection ae ea a A E N ee bodes deere 3 9 National Instruments Corporation v NI Vision Builder for Automated Inspection Tutorial Contents Chapter 4 Inspecting for Multiple Correct Instances of an Object Creating a New Inspections 2e i cccscecsssceeteescsassetteses sesesdascsadecitanceasceacievasszeavecasasauaecseees 4 1 Acquiring Inspection Images ceeeescsssceesceeseececceeceeseecesceesneceacensaeenseseseessaeeeseesees 4 1 Defining a Feature on which to Base a Coordinate System sessseessesesrererrerereereerse 4 2 Setting a Coordi
79. pection Steps palette select the Use Additional Tools tab 2 Click the Logic Calculator step The property page opens in the Main window 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 Inthe 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 NI Vision Builder for Automated Inspection Tutorial 4 8 ni com Chapter 4 Inspecting for Multiple Correct Instances of an Object 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 lt Shift gt key and select the second and third expressions in the Expression table 15 Click to group the expressions T
80. pen Refer to the Vision Builder AI Configuration Interface section of Chapter 1 Introduction to Vision Builder AI for more information Creating a New Inspection Select File New to load a new blank Vision Builder AI inspection Acquiring Inspection Images from Two Cameras For simplicity this tutorial instructs you to use the Simulate Acquisition step However in your real world inspection use one of the other image acquisition steps to acquire images of the object under inspection National Instruments Corporation 5 1 NI Vision Builder for Automated Inspection Tutorial Chapter 5 Inspecting an Object that Spans Two Image Frames Acquiring and Calibrating the Image of the Left Edge ee Complete the following instructions to configure Simulate Acquisition steps that simulate acquiring an image of the left section of the wooden plank and calibrating the image 1 Inthe Inspection Steps palette select the Acquire Images tab 2 Click the Simulate Acquisition step The property page for the step opens 3 Inthe Step Name control enter Acquire Plank Left 4 Click the Browse button The Select an Image File dialog box opens Navigate to lt Vision Builder AI gt DemoImg Tutorial 4 Left where lt Vision Builder AI gt is the location where Vision Builder AI is installed Select the first image Image 01 jpg and click Open Make sure that the Cycle Through Folder Images control is enabled so that Vision Bui
81. property page for the step opens 3 Inthe Inspection Status control select the Set to FAIL if any previous step fails option 4 Click OK to add the step to the inspection NI Vision Builder for Automated Inspection Tutorial 2 8 ni com Chapter 2 Checking for the Presence of a Part Testing the Inspection Test the remaining images in the Tutorial 1 folder to make sure the inspection returns the correct results Click the Run Inspection Once button to test the remaining images Table 2 1 displays the expected results for each image Table 2 1 Expected Results for the Spray Bottle Inspection Image Name Inspection Status Explanation Image 03 jpg PASS Cap is present Image 04 jpg PASS Cap is present Image 05 jpg FAIL Cap is missing Saving the Inspection Complete the following instructions to save the example inspection 1 Select File Save or click the Save button on the toolbar h 2 Navigate to the location where you want to save the inspection 3 Inthe File Name control enter Tutorial 1 vbai 4 Click Save to save the inspection Y Tip Select File Inspection Properties to add a short description or comments about the inspection National Instruments Corporation 2 9 NI Vision Builder for Automated Inspection Tutorial Inspecting Objects for Correct Measurements This chapter introduces image calibration and the Detect Objects and Geometry steps Follow the instructions in
82. rements step is run Setting a Coordinate System Complete the following instructions to configure a Set Coordinate System step based on the Find Pin Edges 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 ds opens va 3 On the Settings tab in the Mode control select Horizontal Motion t because the pins may shift horizontally from one image to another 4 Click OK to add the step to the inspection NI Vision Builder for Automated Inspection Tutorial 7 8 ni com Chapter 7 Looping and Variables Checking the Pin Gap Complete the following instructions to measure the gap between two pins and determine if it is within a certain range 1 A U N In the Inspection Steps palette select the Measure Features tab Click the Caliper step The property page for the step opens In the Step Name control enter Measure Gap Enable the Reposition Region of Interest control and verify that Set Coordinate System is selected for the Reference Coordinate System control Draw an ROI over the gap between the first two pins as shown in Figure 7 7 National Instruments Corporation Figure 7 7 Measuring the Distance Between Pins In the Settings tab select the Process named Horizontal Max Caliper to change the direction and orientation of the caliper search lines On the Limits tab enable the Minimum Distanc
83. run options available for the Configuration interface Table 1 1 Configuration Interface Run Modes Button Name Description Run Inspection Once Runs the inspection through one iteration of the state diagram Run Inspection in Loop Runs the inspection continuously Run Inspection Until Failure Runs the inspection until the Inspection Status variable has a value of FAIL L le LE Run Inspection Multiple Times Runs the inspection a specified number of times This option is available only from the Operate menu Cl Stop Inspection Stops the inspection Highlight Execution Highlights the inspection execution when e you run the inspection If the Highlight Execution button appears yellow execution highlighting is enabled u Pause Pauses or resumes execution of the inspection If the Pause button appears red execution is paused National Instruments Corporation 1 9 NI Vision Builder for Automated Inspection Tutorial Chapter 1 Introduction to Vision Builder Al Table 1 1 Configuration Interface Run Modes Continued Button Name Description Single Step Steps through the inspection Single Step is only available when the Pause button is pressed Use Previous Image Uses the previous inspection image the next time the inspection executes Jse Current Image Uses the current inspection image the next time the inspection executes
84. sforms into the property page for the step e State Configuration window Displays the list of steps in the currently selected state in the inspection Inspection State Diagram Vision Builder AI uses a state diagram to define inspections with unique states and transitions that govern the execution flow of the inspection Simple inspections can be defined using the single state default inspection shown in Figure 1 4 Start default default End Figure 1 4 Default Inspection State Diagram NI Vision Builder for Automated Inspection Tutorial 1 6 ni com Chapter 1 Introduction to Vision Builder Al More complex inspections can be created by adding additional states and transitions to the default state diagram Figure 1 5 shows an example of an inspection that uses the state diagram to perform branching and looping in the inspection Start default age amp Find Acquire I Pin Edges Repeat for Next Pin Wrong Pins End Figure 1 5 Example of a Vision Builder Al Inspection State Diagram Within a state diagram each state can lead to one or multiple states or can end the inspection cycle Each state diagram relies on in state calculations or user input to determine the next state to execute Vision Builder AI executes the state diagram continuously from the Start point to the End point Each state in an inspection is intended to contain a discrete set of inspection steps To acc
85. sion Builder for Automated Inspection Tutorial About This Manual This manual contains many techniques for using NI Vision Builder for Automated Inspection Vision Builder AJ to solve visual inspection tasks including inspection gauging part presence guidance and counting Follow the instructions in this manual to familiarize yourself with Vision Builder AI and perform common inspection tasks This manual contains the following chapters National Instruments Corporation Chapter 1 Introduction to Vision Builder AI introduces the Vision Builder AI environment and describes how to run an inspection Chapter 2 Checking for the Presence of a Part introduces the Match Pattern Measure Intensity and Set Coordinate System steps Follow the instructions in this chapter to create an inspection that checks for the presence of a spray bottle cap regardless of the bottle position in the inspection images Chapter 3 Inspecting Objects for Correct Measurements introduces image calibration and the Detect Objects and Geometry steps Follow the instructions in this chapter to create an inspection that measures the distance between holes in a gasket to verify that the gasket conforms to manufacturing specifications Chapter 4 Inspecting for Multiple Correct Instances of an Object introduces the Find Straight Edge Caliper and Decision Making steps Follow the instructions in this chapter to create an inspection that measures the dis
86. small holes have sizes of 61 97 mm and 61 04 mm Set Minimum Object Size to 50 and Maximum Object Size to 70 In the Limits tab enable the Minimum Number of Objects and Maximum Number of Objects controls Set their values to 2 Click OK to add the step to the inspection Complete the following instructions to find the large hole in the gasket 1 4 Right click the Detect Small Holes step in the State Configuration window and select Copy Right click the Detect Small Holes step again Select Paste A copy of the Detect Small Holes step is placed after the original step Double click the Detect Small Holes copy or click the Edit Step button to launch the property page of the step for editing In the Step Name control enter Detect Large Hole NI Vision Builder for Automated Inspection Tutorial 3 6 ni com 9 Chapter 3 Inspecting Objects for Correct Measurements Select the Settings tab Based on the information in Table 3 1 the large hole has a size of 1410 15 mm Set Minimum Object Size to 1300 and Maximum Object Size to 1450 In the Limits tab enable the Minimum Number of Objects and Maximum Number of Objects controls Set their values to 1 Click OK to add the step to the inspection Measuring Parts of the Gasket Complete the following instructions to measure the distance from the top small hole to the large hole to inspect whether the distance meets specifications 3 Note Vision Builder A
87. t be obtained from the factory and clearly marked on the outside of the package before any equipment will be accepted for warranty work National Instruments will pay the shipping costs of returning to the owner parts which are covered by warranty National Instruments believes that the information in this document is accurate The document has been carefully reviewed for technical accuracy In the event that technical or typographical errors exist National Instruments reserves the right to make changes to subsequent editions of this document without prior notice to holders of this edition The reader should consult National Instruments if errors are suspected In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it EXCEPT AS SPECIFIED HEREIN NATIONAL INSTRUMENTS MAKES NO WARRANTIES EXPRESS OR IMPLIED AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE CUSTOMER S RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER NATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA PROFITS USE OF PRODUCTS OR INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF ADVISED OF THE POSSIBILITY THEREOF This limitation of the liability of National Instruments will apply regardless of the form of action whether in contract or
88. t it to the input terminal of Part Width 5 15 NI Vision Builder for Automated Inspection Tutorial Chapter 5 Inspecting an Object that Spans Two Image Frames Your connected Calculator diagram should look similar to the diagram shown in Figure 5 10 Find Right Edge Edge 1 Position Calibrated Right LC Step Result Figure 5 10 Connected Elements of Calculator Diagram 5 Inthe Calculator step property page click the Measurements tab 6 Click Compute Results to see the results of the calculation thus far Making Logical PASS FAIL Decisions with the Calculator Step Now that you have a created a diagram to measure the width of the part you need a way to verify that the width meets manufacturing specifications Complete the following instructions to add diagram elements that compare the measured width to minimum and maximum width tolerances and decide whether the plank passes inspection 1 Click the up arrow in the Functions palette to return to the main palette 2 Select the Comparison palette 3 Click the Less operator in the Comparison palette Click inside the Calculator diagram below Part Width 4 Connect the wire between Subtract and Part Width to the x input of the Less operator Click the up arrow in the Functions palette to return to the main palette Select the Numeric palette Click the Num Const operator in the Numeric palette Coy i Gyn N Click close enough to the y input of
89. tance between the blade connectors of a fuse and checks the integrity of the fuse conductor regardless of the fuse position or whether the fuse is inverted Chapter 5 Inspecting an Object that Spans Two Image Frames introduces the Select Image and Calculator steps Follow the instructions in this chapter to create an inspection that measures the width of a wooden plank that spans two images Chapter 6 Branching and Decision Making introduces the inspection state diagram and the Custom Overlay step Follow the instructions in this chapter to create an inspection that checks the image for the presence of a spray bottle and if a bottle is present transitions to another state to determine if the bottle has a cap If there is no spray bottle present in the image the inspection moves on to the next image ix NI Vision Builder for Automated Inspection Tutorial About This Manual Conventions e Chapter 7 Looping and Variables uses the inspection state diagram to implement a looping inspection and introduces the Set Variable and Index Measurements steps Follow the instructions in this chapter to create an inspection that inspects images of electronic components to determine if the distance between pins on the component is within a predetermined range If the pin is too close or too far away from an adjacent pin then the inspection fails The inspection does not need to check every pin on the microchip before failing the inspection The insp
90. tch score object National Instruments Corporation G 1 A reference location origin and angle in an image that ROIs can relate to when positional and angular adjustments of the ROI are necessary A coordinate system is depicted by two lines representing the orientation and direction of its two axes A format for information Acceptable data types for most functions are numeric array and string The area of inspection that the camera can acquire as an image The pixel location in a pattern matching template whose coordinates are returned as the location of a match in the inspection image A vision inspection application created in and run from Vision Builder AI that can perform inline or offline visual inspections The gray level value of a pixel in a grayscale image A number ranging from 0 to 1 000 that indicates how closely an area of an acquired image matches the template image A match score of 1 000 indicates a perfect match A match score of 0 indicates no match A connected region or grouping of pixels in an image in which all pixels have intensity levels in the same range NI Vision Builder for Automated Inspection Tutorial Glossary P pattern matching pixel R resolution ROI S spatial calibration state state diagram step T template transition The technique used to quickly locate a grayscale template within a grayscale image Picture element The smallest division that m
91. teps palette select the Use Additional Tools tab Click the Set Variable step The property page for the step opens in the Main window In the Step Name control enter Initialize Counter 7 7 NI Vision Builder for Automated Inspection Tutorial Chapter 7 Looping and Variables 4 Inthe Operation control select the Set to Constant option and enter 1 for the value 5 Click OK to add the step to the inspection Indexing Measurements Complete the following instructions to configure an Index Measurements step to select the x and y position of the ith edge found by the Find Pin Edges step in the Acquire Image amp Find Pin Edges state where i is the value of the Counter variable 1 Inthe Overview window click the Check Pin Gap state on the state heck Pin Gap diasram gram 2 Inthe Inspection Steps palette select the Use Additional Tools tab 3 Click the Index Measurements step The property page for the step opens 4 Inthe Step Name control enter Get Edge Position 5 Inthe Measurements control select Edge i X Position and Edge i Y Position 6 Inthe Index control select Inspection Variable Counter from the drop down listbox 7 Click OK to add the step to the inspection In the Updating the Variable section of this tutorial you will set the Counter variable to increment by one each time the Check Pin Gap state is run This ensures that a different set of pins is inspected each time the Index Measu
92. th edge found by the Get Edge Position step In the X Offset control enter 35 In the Y Offset control enter 28 This positions the indicator overlay over the gap between two pins In the Value control select Measure Gap Step Status to set the indicator overlay to display the Step Status for the Measure Gap step in the inspection Delete the text in the True Text control since the overlay is only displayed if the inspection fails Set the Fill to transparent In the False Text control enter FAIL Set the Fill to red 10 Click OK to add the step to the inspection NI Vision Builder for Automated Inspection Tutorial 7 10 ni com Chapter 7 Looping and Variables Setting the Inspection Status Complete the following instructions to set the Inspection Status for the inspection 1 ail Inspection 2 E Si OO SY ON e oe In the Overview Window click the Fail Inspection state on the state diagram In the Inspection Steps palette select the Use Additional Tools tab Click the Set Inspection Status step The property page for the step opens In the Step Name control enter Set Inspection Status In the Inspection Status control select the Set to FAIL option Enable the Update Number of Parts Inspected checkbox Click OK to add the step to the inspection In the Overview Window click the Pass Inspection state on the state diagram In the Inspection Steps palette select the Use Additional Tools tab Cli
93. the state diagram The currently selected state is highlighted in blue on the state diagram National Instruments Corporation 6 5 NI Vision Builder for Automated Inspection Tutorial Chapter 6 Branching and Decision Making Acquiring Inspection Images For simplicity this tutorial instructs you to use the Simulate Acquisition step However in your real world inspection use one of the other image acquisition steps to acquire images of the object under inspection Complete the following instructions to configure a Simulate Acquisition step that simulates acquiring images of spray bottles 1 heck Part Presence 2 a 3 a On the state diagram click the Check Part Presence state In the Inspection Steps palette select the Acquire Images tab Click the Simulate Acquisition step The property page for the step opens ay Note When the property page for an inspection step opens if the state diagram is displayed in the Main window the state diagram switches from the Main window to the Overview window to allow you to use the current inspection image to configure the step 4 9 In the Step Name control enter Acquire Image Click the Browse button The Select an Image File dialog box opens Navigate to lt Vision Builder AI gt DemoImg Tutorial 5 where lt Vision Builder AI gt is the location where Vision Builder AI is installed Select an image containing the entire spray bottle such as Image 00480 jpg and c
94. tion information and exit the calibration training interface 21 Click OK to add the step to the inspection Locating the Right Edge of the Part Complete the following instructions to configure a Find Edges step that locates the right edge of the part 1 In the Inspection Steps palette select the Locate Features tab 2 Click the Find Edges step The property page for the step opens 3 Inthe Step Name control enter Find Right Edge National Instruments Corporation 5 7 NI Vision Builder for Automated Inspection Tutorial Chapter 5 Inspecting an Object that Spans Two Image Frames 4 Draw a line across the right edge of the part going from right to left as shown in Figure 5 5 Tip Pressing the lt Shift gt key while drawing a line constrains the line tool to only draw horizontal or vertical lines 5 Click the Settings tab 6 Inthe Look for control select First Edge 7 In the Edge Polarity control select Bright to Dark Only Find Right Edge 38 39 40 41 42 43 44 Figure 5 5 Finding the Right Edge of the Plank Notice the red square on the search line The step searches along the search line for a sharp transition in pixel intensities which usually represents an object edge The red square marks the location of the right edge of the part 8 Click OK to add the step to the inspection NI Vision Builder for Automated Inspection Tutorial 5 8 ni com Chapter 5 Inspecting an Object that Spans
95. tputs you specified in the Calculator Setup Wizard as shown in Figure 5 7 The diagram also contains a default Boolean result named Step Result You can connect the result of a computation to Step Result which changes the status of the Calculator step to the result of the computation Refer to the Making Logical PASS FAIL Decisions with the Calculator Step section of this chapter for more information about Step Result Find Right Edge Edge 1 Position Calibrated Step Result TF Find Left Edge Edge 1 Position Calibrated Part Width E DE Right LC DBI Figure 5 7 Calculator Diagram Elements Notice that the inputs and outputs are framed with color and have codes at the bottom of their frames These colors and codes visually group inputs and outputs into their respective data types numerics Booleans or strings NI Vision Builder for Automated Inspection Tutorial 5 12 ni com Chapter 5 Inspecting an Object that Spans Two Image Frames 13 To simplify the process of connecting the diagram elements later in this chapter arrange the elements into the configuration shown in Figure 5 8 by dragging them to their new positions Find Right Edge Edge 1 Position Calibrated ight Edg g l t Right LO DBI Find Left Edge Edge 1 X Position Calibrated Part Width fizi p 23 Step Result Figure 5 8 Arranging Diagram Elements Adding Operators and Constants Earlier in this chapter yo
96. u used the Calibration Wizard to set calibration axis origins for the right and left sides of the part These origins are the only elements of Equations 5 1 and 5 2 not yet represented in the Calculator diagram Origin R and Origin L In step 18 of the Acquiring and Calibrating the Image of the Right Edge section of this chapter you set the origin of the right side to the 38 cm marking of the imaged ruler In step 18 of the Acquiring and Calibrating the Image of the Left Edge section of this chapter you set the origin of the left side to the 1 cm marking of the imaged ruler Therefore Origin R Origin L 38 1 37 The distance between the calibration axis origins is a constant value Add a constant with the value 37 to the Calculator diagram 123 1 In the Functions palette click Numeric 2 Click the Num Const operator Click inside the Calculator diagram below the Find Right Edge Edge 1 X Position Calibrated input measurement to place the numeric constant on the Calculator diagram 123 3 Double click the numeric constant and type 37 to set the value of the constant National Instruments Corporation 5 13 NI Vision Builder for Automated Inspection Tutorial Chapter 5 Inspecting an Object that Spans Two Image Frames gt 4 Click the Add operator in the Functions palette Click inside the Calculator diagram to the right of the Find Right Edge Edge 1 X Position Calibrated input measurement Tip Pl
97. ult Rectangle Tool draw a region of interest ROD around the entire gasket as shown in Figure 3 2 Figure 3 2 Defining the ROI 5 Inthe Threshold tab select the Bright Objects option for the Look For control Notice that the blue shading highlights all bright pixels pixels with high intensity values that fall within the Threshold Range in the ROI Vision Builder AI groups contiguous highlighted pixels into objects which are depicted by red bounding rectangles National Instruments Corporation 3 5 NI Vision Builder for Automated Inspection Tutorial Chapter 3 Inspecting Objects for Correct Measurements 6 Click the Settings tab The step locates four objects which are listed in Table 3 1 Depending on the location of the user defined points previously configured in the calibration the values for the Size mm may differ slightly from the values shown in Table 3 1 Table 3 1 Sizes of Gasket Holes Object Number Size pix Size mm 1 1 807 62 43 2 13 351 461 26 3 40 816 1410 15 4 1 780 61 50 Object 1 and Object 4 are the small holes of interest in this step The following steps describe how to use the Minimum Object Size and Maximum Object Size controls of the Detect Objects step to eliminate objects of no interest based on their size 7 10 Enable the Minimum Object Size and Maximum Object Size controls Based on the information in Table 3 1 the
Download Pdf Manuals
Related Search
Related Contents
Mode d`emploi du marbrage - stellarsupport global Condiciones de Garantía de Toshiba Danfoss Air Sony DSC-W370/G Marketing Specifications Impressora Térmica Portátil Leopardo Modelo A7 User Manual - Orion FX Lights Copyright © All rights reserved.