logo资料库

NI labview IMAQ工具包使用手册,全英文版.pdf

第1页 / 共131页
第2页 / 共131页
第3页 / 共131页
第4页 / 共131页
第5页 / 共131页
第6页 / 共131页
第7页 / 共131页
第8页 / 共131页
资料共131页,剩余部分请下载后查看
IMAQ Vision for LabVIEW User Manual
Support
Worldwide Technical Support and Product Information
National Instruments Corporate Headquarters
Worldwide Offices
Important Information
Warranty
Copyright
Trademarks
Patents
WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS
Contents
About This Manual
Conventions
Related Documentation
IMAQ Vision
NI Vision Assistant
NI Vision Builder for Automated Inspection
Other Documentation
Chapter 1 Introduction to IMAQ Vision
About IMAQ Vision
IMAQ Vision Control Palette
IMAQ Vision Function Palettes
Vision Utilities
Image Processing
Machine Vision
Creating IMAQ Vision Applications
Figure 1-1. General Steps to Designing a Vision Application
Figure 1-2. Inspection Steps for Building a Vision Application
Chapter 2 Getting Measurement-Ready Images
Set Up Your Imaging System
Calibrate Your Imaging System
Create an Image
Input and Output Combinations
Image Analysis
Image Masks
Image Filling
Image Processing
Arithmetic and Logical Operations
Acquire or Read an Image
Display an Image
External Window Display
Image Display Control
Figure 2-1. LabVIEW Image Display Control
Figure 2-2. An Image Wired into the Image Display Control Terminal
Attach Calibration Information
Analyze an Image
Improve an Image
Lookup Tables
Filters
Convolution Filter
Nth Order Filter
Grayscale Morphology
FFT
Advanced Operations
Chapter 3 Grayscale and Color Measurements
Figure 3-1. Steps for Taking Grayscale and Color Measurements
Define Regions of Interest
Table 3-1. Tools Palette Functions
Define Regions Interactively
Defining an ROI in the Image Display Control
Defining an ROI in an External Window
Defining an ROI Using an ROI Constructor
Figure 3-2. ROI Constructor
Tools Palette Transformation
Figure 3-3. Tools Palette Tools and Information
Define Regions Programmatically
Define Regions with Masks
Measure Grayscale Statistics
Measure Color Statistics
Figure 3-4. Primary Components of a Color Image
Compare Colors
Learn Color Information
Specifying the Color Information to Learn
Figure 3-5. Template Color Information
Figure 3-6. Using the Entire Image to Learn Color Distribution
Figure 3-7. Using a Single Region to Learn Color Distribution
Figure 3-8. Using Multiple Regions to Learn Color Distribution
Choosing a Color Representation Sensitivity
Ignoring Learned Colors
Chapter 4 Particle Analysis
Figure 4-1. Steps for Performing Particle Analysis
Create a Binary Image
Improve the Binary Image
Remove Unwanted Particles
Separate Touching Particles
Improve Particle Shapes
Make Particle Measurements
Chapter 5 Machine Vision
Figure 5-1. Steps for Performing Machine Vision
Locate Objects to Inspect
Use Edge Detection to Build a Coordinate Transformation
Figure 5-2. Coordinate Systems of a Reference Image and Inspection Image
Figure 5-3. Locating Coordinate System Axes with Two Search Areas
Use Pattern Matching to Build a Coordinate Transformation
Choose a Method to Build the Coordinate Transformation
Figure 5-4. Building a Coordinate Transformation
Set Search Areas
Defining Regions Interactively
Defining Regions Programmatically
Find Measurement Points
Finding Features Using Edge Detection
Finding Lines or Circles
Figure 5-5. Finding a Straight Feature
Figure 5-6. Finding a Circular Feature
Finding Edge Points Along One Search Contour
Finding Edge Points Along Multiple Search Contours
Find Points Using Pattern Matching
Defining and Creating Good Template Images
Figure 5-7. Symmetry
Figure 5-8. Feature Detail
Figure 5-9. Positional Information
Figure 5-10. Background Information
Training the Pattern Matching Algorithm
Defining a Search Area
Figure 5-11. Selecting a Search Area for Grayscale Pattern Matching
Setting Matching Parameters and Tolerances
Testing the Search Algorithm on Test Images
Using a Ranking Method to Verify Results
Find Points Using Color Pattern Matching
Defining and Creating Good Color Template Images
Training the Color Pattern Matching Algorithm
Defining a Search Area
Figure 5-12. Selecting a Search Area for Color Pattern Matching
Setting Matching Parameters and Tolerances
Testing the Search Algorithm on Test Images
Find Points Using Color Location
Convert Pixel Coordinates to Real-World Coordinates
Make Measurements
Distance Measurements
Analytic Geometry Measurements
Instrument Reader Measurements
Display Results
Chapter 6 Calibration
Perspective and Nonlinear Distortion Calibration
Define a Calibration Template
Figure 6-1. Defining a Calibration Grid
Define a Reference Coordinate System
Figure 6-2. Axis Direction in the Image Plane
Figure 6-3. A Calibration Grid and an Image of the Grid
Figure 6-4. Defining a Coordinate System
Learn Calibration Information
Specifying Scaling Factors
Choosing a Learning Algorithm
Choosing a Region of Interest
Figure 6-5. Types of Image Distortion
Figure 6-6. Calibration ROIs
Using the Learning Score
Learning the Error Map
Learning the Correction Table
Setting the Scaling Method
Calibration Invalidation
Simple Calibration
Figure 6-7. Defining a Simple Calibration
Save Calibration Information
Attach Calibration Information
Appendix A Vision for LabVIEW Real-Time
Appendix B Technical Support and Professional Services
Glossary
Numbers/Symbols
A
B
C
D-E
F-G
H
I
J-L
M-N
O
P
Q-R
S
T-V
Index
A-C
D-G
H-I
K-L
M-N
O-S
T-W
IMAQ TM IMAQ Vision for LabVIEWTM User Manual IMAQ Vision for LabVIEW User Manual June 2003 Edition Part Number 322917B-01
Support Worldwide Technical Support and Product Information ni.com National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin, Texas 78759-3504 USA Tel: 512 683 0100 Worldwide Offices Australia 1800 300 800, Austria 43 0 662 45 79 90 0, Belgium 32 0 2 757 00 20, Brazil 55 11 3262 3599, Canada (Calgary) 403 274 9391, Canada (Montreal) 514 288 5722, Canada (Ottawa) 613 233 5949, Canada (Québec) 514 694 8521, Canada (Toronto) 905 785 0085, Canada (Vancouver) 514 685 7530, China 86 21 6555 7838, Czech Republic 420 2 2423 5774, Denmark 45 45 76 26 00, Finland 385 0 9 725 725 11, France 33 0 1 48 14 24 24, Germany 49 0 89 741 31 30, Greece 30 2 10 42 96 427, India 91 80 51190000, Israel 972 0 3 6393737, Italy 39 02 413091, Japan 81 3 5472 2970, Korea 82 02 3451 3400, Malaysia 603 9131 0918, Mexico 001 800 010 0793, Netherlands 31 0 348 433 466, New Zealand 1800 300 800, Norway 47 0 66 90 76 60, Poland 48 0 22 3390 150, Portugal 351 210 311 210, Russia 7 095 238 7139, Singapore 65 6226 5886, Slovenia 386 3 425 4200, South Africa 27 0 11 805 8197, Spain 34 91 640 0085, Sweden 46 0 8 587 895 00, Switzerland 41 56 200 51 51, Taiwan 886 2 2528 7227, Thailand 662 992 7519, United Kingdom 44 0 1635 523545 For further support information, refer to the Technical Support and Professional Services appendix. To comment on the documentation, send email to techpubs@ni.com. © 2000–2003 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 must 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 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. Trademarks CVI™, IMAQ™, LabVIEW™, Measurement Studio™, National Instruments™, NI™, NI Developer Zone™, ni.com™, and NI-IMAQ™ are trademarks of National Instruments Corporation. Product and company names mentioned herein are trademarks or trade names of their respective companies. Patents For patents covering National Instruments products, refer to the appropriate location: Help»Patents in your software, the patents.txt file on your CD, or ni.com/patents. 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 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 INSTRUMENTS 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 Conventions ...................................................................................................................ix Related Documentation..................................................................................................x IMAQ Vision...................................................................................................x NI Vision Assistant..........................................................................................x NI Vision Builder for Automated Inspection ..................................................x Other Documentation ......................................................................................xi Chapter 1 Introduction to IMAQ Vision About IMAQ Vision ......................................................................................................1-1 IMAQ Vision Control Palette ........................................................................................1-1 IMAQ Vision Function Palettes ....................................................................................1-2 Vision Utilities.................................................................................................1-2 Image Processing.............................................................................................1-4 Machine Vision ...............................................................................................1-5 Creating IMAQ Vision Applications.............................................................................1-6 Chapter 2 Getting Measurement-Ready Images Set Up Your Imaging System ........................................................................................2-1 Calibrate Your Imaging System ....................................................................................2-2 Create an Image .............................................................................................................2-2 Input and Output Combinations ......................................................................2-4 Image Analysis..................................................................................2-4 Image Masks .....................................................................................2-4 Image Filling .....................................................................................2-5 Image Processing ..............................................................................2-5 Arithmetic and Logical Operations...................................................2-6 Acquire or Read an Image .............................................................................................2-6 Display an Image ...........................................................................................................2-8 External Window Display ...............................................................................2-8 Image Display Control ....................................................................................2-9 Attach Calibration Information......................................................................................2-11 Analyze an Image ..........................................................................................................2-12 Improve an Image ..........................................................................................................2-13 Lookup Tables .................................................................................................2-13 © National Instruments Corporation v IMAQ Vision for LabVIEW User Manual
Contents Filters .............................................................................................................. 2-14 Convolution Filter............................................................................. 2-14 Nth Order Filter ................................................................................ 2-14 Grayscale Morphology.................................................................................... 2-15 FFT.................................................................................................................. 2-15 Advanced Operations ....................................................................... 2-17 Chapter 3 Grayscale and Color Measurements Define Regions of Interest............................................................................................. 3-1 Define Regions Interactively .......................................................................... 3-3 Defining an ROI in the Image Display Control................................ 3-3 Defining an ROI in an External Window ......................................... 3-4 Defining an ROI Using an ROI Constructor .................................... 3-4 Tools Palette Transformation ........................................................... 3-6 Define Regions Programmatically .................................................................. 3-7 Define Regions with Masks ............................................................................ 3-8 Measure Grayscale Statistics......................................................................................... 3-9 Measure Color Statistics................................................................................................ 3-9 Compare Colors .............................................................................................. 3-11 Learn Color Information ................................................................................ 3-11 Specifying the Color Information to Learn ...................................... 3-11 Choosing a Color Representation Sensitivity ................................... 3-14 Ignoring Learned Colors................................................................... 3-15 Chapter 4 Particle Analysis Create a Binary Image ................................................................................................... 4-1 Improve the Binary Image............................................................................................. 4-2 Remove Unwanted Particles ........................................................................... 4-3 Separate Touching Particles............................................................................ 4-4 Improve Particle Shapes.................................................................................. 4-4 Make Particle Measurements ........................................................................................ 4-4 Chapter 5 Machine Vision Locate Objects to Inspect .............................................................................................. 5-2 Use Edge Detection to Build a Coordinate Transformation .......................... 5-3 Use Pattern Matching to Build a Coordinate Transformation ....................... 5-6 Choose a Method to Build the Coordinate Transformation............................ 5-6 IMAQ Vision for LabVIEW User Manual vi ni.com
Contents Set Search Areas ............................................................................................................5-8 Defining Regions Interactively........................................................................5-8 Defining Regions Programmatically ...............................................................5-9 Find Measurement Points .............................................................................................5-9 Finding Features Using Edge Detection..........................................................5-9 Finding Lines or Circles....................................................................5-9 Finding Edge Points Along One Search Contour ............................5-11 Finding Edge Points Along Multiple Search Contours.....................5-12 Find Points Using Pattern Matching................................................................5-13 Defining and Creating Good Template Images ................................5-13 Training the Pattern Matching Algorithm.........................................5-15 Defining a Search Area .....................................................................5-15 Setting Matching Parameters and Tolerances...................................5-17 Testing the Search Algorithm on Test Images..................................5-18 Using a Ranking Method to Verify Results ......................................5-18 Find Points Using Color Pattern Matching .....................................................5-18 Defining and Creating Good Color Template Images ......................5-19 Training the Color Pattern Matching Algorithm...............................5-20 Defining a Search Area .....................................................................5-21 Setting Matching Parameters and Tolerances...................................5-22 Testing the Search Algorithm on Test Images..................................5-24 Find Points Using Color Location...................................................................5-25 Convert Pixel Coordinates to Real-World Coordinates ................................................5-25 Make Measurements ......................................................................................................5-26 Distance Measurements...................................................................................5-26 Analytic Geometry Measurements ..................................................................5-27 Instrument Reader Measurements ...................................................................5-27 Display Results ..............................................................................................................5-28 Chapter 6 Calibration Perspective and Nonlinear Distortion Calibration .........................................................6-1 Define a Calibration Template ........................................................................6-2 Define a Reference Coordinate System...........................................................6-3 Learn Calibration Information.........................................................................6-5 Specifying Scaling Factors................................................................6-5 Choosing a Region of Interest ..........................................................6-6 Choosing a Learning Algorithm .......................................................6-6 Using the Learning Score..................................................................6-7 Learning the Error Map.....................................................................6-8 Learning the Correction Table .........................................................6-8 Setting the Scaling Method ...............................................................6-8 Calibration Invalidation ...................................................................6-8 © National Instruments Corporation vii IMAQ Vision for LabVIEW User Manual
Contents Simple Calibration......................................................................................................... 6-9 Save Calibration Information ........................................................................................ 6-10 Attach Calibration Information .................................................................................... 6-10 Appendix A Vision for LabVIEW Real-Time About Vision for LabVIEW Real-Time ........................................................................ A-1 System Components ...................................................................................................... A-1 Development System ...................................................................................... A-1 Deployed System ............................................................................................ A-2 Installing NI-IMAQ and Vision for LabVIEW Real-Time........................................... A-2 Displaying Images in Vision for LabVIEW Real-Time................................................ A-2 Remote Display............................................................................................... A-3 RT Video Out.................................................................................................. A-4 Determinism in Vision for LabVIEW Real-Time ......................................................... A-4 Determinism vs. Time-Bounded Execution.................................................... A-5 Time-Bounded Execution ............................................................................... A-6 Initializing the Timed Environment ................................................. A-6 Preparing Resources ......................................................................... A-7 Performing Time-Bounded Vision Operations................................. A-7 Closing the Timed Environment ..................................................................... A-9 Image Files .................................................................................................................... A-9 Deployment ................................................................................................................... A-9 Troubleshooting............................................................................................................. A-9 Remote Display Errors.................................................................................... A-9 Programming Errors........................................................................................ A-10 RT Video Out Errors....................................................................................... A-12 Appendix B Technical Support and Professional Services Glossary Index IMAQ Vision for LabVIEW User Manual viii ni.com
About This Manual The IMAQ Vision for LabVIEW User Manual is intended for engineers and scientists who have knowledge of the LabVIEW programming environment and need to create machine vision and image processing applications using LabVIEW VIs. The manual guides you through tasks beginning with setting up your imaging system to taking measurements. It also describes how to create a real-time vision application using Vision for LabVIEW Real-Time. 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 File»Page Setup»Options directs you to pull down the File menu, select the Page Setup item, and select Options 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. 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. This font 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, and code excerpts. Conventions » bold italic monospace monospace bold Bold text in this font denotes the messages and responses that the computer automatically prints to the screen. This font also emphasizes lines of code that are different from the other examples. © National Instruments Corporation ix IMAQ Vision for LabVIEW User Manual
分享到:
收藏