Résumé du contenu de la page N° 1
TM
IMAQ
IMAQ Vision for Visual Basic
User Manual
IMAQ Vision for Visual Basic User Manual
August 2004 Edition
Part Number 371257A-01
Résumé du contenu de la page N° 2
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 (Ottawa) 613 233 5949, Canada (Québec) 450 510 3055, Canada (Toronto) 905 785 0085, Canada (Vancouver) 604 685 7530, China 86 21 6555 7838, Czech Repub
Résumé du contenu de la page N° 3
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 per
Résumé du contenu de la page N° 4
Contents About This Manual Conventions ...................................................................................................................ix Related Documentation..................................................................................................x Chapter 1 Introduction to IMAQ Vision About IMAQ Vision ......................................................................................................1-1 Documentation and Examples .................................
Résumé du contenu de la page N° 5
Contents Improve an Image.......................................................................................................... 2-9 Lookup Tables................................................................................................. 2-9 Filters .............................................................................................................. 2-9 Convolution Filter............................................................................. 2-10 Nth Order Filter ........
Résumé du contenu de la page N° 6
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 Detec
Résumé du contenu de la page N° 7
Contents Chapter 6 Calibrating Images Perspective and Nonlinear Distortion Calibration......................................................... 6-1 Defining a Calibration Template..................................................................... 6-2 Defining a Reference Coordinate System....................................................... 6-3 Learning Calibration Information ................................................................... 6-5 Specifying Scaling Factors .................
Résumé du contenu de la page N° 8
About This Manual The IMAQ Vision for Visual Basic User Manual is intended for engineers and scientists who have knowledge of Microsoft Visual Basic and need to create machine vision and image processing applications using Visual Basic objects. The manual guides you through tasks beginning with setting up the imaging system to taking measurements. Conventions The following conventions appear in this manual: » The » symbol leads you through nested menu items and dialog box options to a fina
Résumé du contenu de la page N° 9
About This Manual Related Documentation This manual assumes that you are familiar with Visual Basic and can use ActiveX controls in Visual Basic. The following are good sources of information about Visual Basic and ActiveX controls: msdn.microsoft.com Documentation that accompanies Microsoft Visual Studio In addition to this manual, the following documentation resources are available to help you create your vision application. IMAQ Vision IMAQ Vision Concepts Manual—If you are new to ma
Résumé du contenu de la page N° 10
About This Manual NI Vision Builder for Automated Inspection: Inspection Help—If you need information about how to run an automated vision inspection system using NI Vision Builder AI, refer to this help file. Other Documentation NI OCR Training Interface Help—If you need information about the OCR Training Interface, refer to this help file. National Instruments IMAQ device user manual—If you need installation instructions and device-specific information, refer to your device user man
Résumé du contenu de la page N° 11
1 Introduction to IMAQ Vision This chapter describes the IMAQ Vision for Visual Basic software and associated software products, discusses the documentation and examples available, outlines the IMAQ Vision for Visual Basic architecture, and lists the steps for creating a machine vision application. Note For information about the system requirements and installation procedure for IMAQ Vision for Visual Basic, refer to the Vision Development Module Release Notes that came with the software. A
Résumé du contenu de la page N° 12
Chapter 1 Introduction to IMAQ Vision In addition to this manual, several documentation resources are available to help you create a vision application: IMAQ Vision Concepts Manual—If you are new to machine vision and imaging, read this manual to understand the concepts behind IMAQ Vision. IMAQ Vision for Visual Basic Reference—If you need information about individual methods, properties, or objects, refer to this help file. Access this file from within Visual Basic or from the Start me
Résumé du contenu de la page N° 13
Chapter 1 Introduction to IMAQ Vision cwimaq.ocx cwimaq.ocx contains the following three ActiveX controls and a collection of ActiveX objects: CWIMAQ, CWIMAQVision, and CWIMAQViewer. Refer to the ActiveX Objects section for information about the ActiveX objects. CWIMAQ Control Use this control to configure and perform an acquisition from the IMAQ device. The CWIMAQ control has property pages that allow you to modify various parameters to configure the acquisition and gather information abo
Résumé du contenu de la page N° 14
Chapter 1 Introduction to IMAQ Vision niocr.ocx niocr.ocx provides one ActiveX control and a collection of ActiveX objects you use in a machine vision application to perform optical character recognition (OCR). NIOCR control Use this control to perform OCR, which is the process by which the machine vision software reads text and/or characters in an image. OCR consists of the following two procedures: Training characters Reading characters Training characters is the process by which yo
Résumé du contenu de la page N° 15
Chapter 1 Introduction to IMAQ Vision Tip Refer to the source code of the CWMachineVision control for an example of how to use the CWIMAQVision methods. ActiveX Objects Use the objects to group related input parameters and output parameters to certain methods, thus reducing the number of parameters that you actually need to pass to those methods. Note ActiveX objects in cwimaq.ocx have a CWIMAQ prefix, objects in niocr.ocx have an NIOCR prefix, and objects in cwmv.ocx have a CWMV prefix. Yo
Résumé du contenu de la page N° 16
Chapter 1 Introduction to IMAQ Vision Set Up Your Imaging System Chapter 6: Calibrate Your Imaging System Calibrating Images Create an Image Acquire or Read an Image Chapter 2: Getting Measurement-Ready Images Display an Image Attach Calibration Information Analyze an Image Impro Improv ve e an Image an Image Make Measurements or Identify Objects in an Image Using 1 Grayscale or Color Measurements, and/or 2 Particle Analysis, and/or 3 Machine Vision Figure 1-1. General Steps for Designing a Vi
Résumé du contenu de la page N° 17
Chapter 1 Introduction to IMAQ Vision 2 Define Regions of Interest Chapter 3: Making Grayscale and Color Measurements Measure Measure Grayscale Statistics Color Statistics 3 4 Create a Binary Image Locate Objects to Inspect Chapter 4: Performing Set Search Areas Improve a Binary Image Particle Analysis Find Measurement Points Identify Parts Under Inspection Chapter 5: Make Particle Measurements Performing Classify Read Read Machine Objects Characters Symbologies Vision Convert Pixel Coordinate
Résumé du contenu de la page N° 18
2 Getting Measurement-Ready Images This chapter describes how to set up an imaging system, acquire and display an image, analyze the image, and prepare the image for additional processing. Set Up Your Imaging System Before you acquire, analyze, and process images, you must set up an imaging system. The manner in which you set up the system depends on the imaging environment and the type of analysis and processing you need to do. Your imaging system should produce images with high enough qu
Résumé du contenu de la page N° 19
Chapter 2 Getting Measurement-Ready Images color and monochrome devices as well as digital devices. Visit ni.com/imaq for more information about IMAQ devices. 4. Configure the driver software for the image acquisition device. If you have a National Instruments image acquisition device, configure the NI-IMAQ driver software through Measurement & Automation Explorer (MAX). Open MAX by double-clicking the Measurement & Automation Explorer icon on the desktop. For more information, refer to th
Résumé du contenu de la page N° 20
Chapter 2 Getting Measurement-Ready Images Complex 32-bit RGB 32-bit HSL 64-bit RGB When you create an image, it is an 8-bit image by default. You can set the Type property on the image object to change the image type. When you create an image, no memory is allocated to store the image pixels. IMAQ Vision methods automatically allocate the appropriate amount of memory when the image size is modified. For example, methods that acquire or resample an image alter the image size, so they