Resumen del contenido incluido en la página 1
™
IMAQ
IMAQ Vision
™
for Measurement Studio
User Manual
LabWindows/CVI
IMAQ Vision for LabWindows/CVI User Manual
May 2001 Edition
Part Number 323022A-01
Resumen del contenido incluido en la página 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 794 0100 Worldwide Offices Australia 03 9879 5166, Austria 0662 45 79 90 0, Belgium 02 757 00 20, Brazil 011 284 5011, Canada (Calgary) 403 274 9391, Canada (Ontario) 905 785 0085, Canada (Québec) 514 694 8521, China 0755 3904939, Denmark 45 76 26 00, Finland 09 725 725 11, France 01 48 14 24 24, Germany 089 741 31 30, G
Resumen del contenido incluido en la página 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 period.
Resumen del contenido incluido en la página 4
Conventions The following conventions are used 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 note, which alerts you to important information. bold Bold text denotes items that you must select or click on in the software, such as menu items and dialog box options. Bol
Resumen del contenido incluido en la página 5
Contents Chapter 1 Introduction to IMAQ Vision About IMAQ Vision ......................................................................................................1-1 Documentation and Examples .......................................................................................1-1 Application Development Environments.......................................................................1-2 IMAQ Vision Function Tree...........................................................................
Resumen del contenido incluido en la página 6
Contents Measure Color Statistics................................................................................................ 3-7 Comparing Colors ........................................................................................... 3-8 Learning Color Information ............................................................................ 3-9 Choosing the Right Color Information............................................. 3-9 Specifying the Color Information to Learn .................
Resumen del contenido incluido en la página 7
Contents 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 Finding Points Using Color Location..............................................................5-25 Convert Pixel Coordinates to Real-World Coordin
Resumen del contenido incluido en la página 8
1 Introduction to IMAQ Vision This chapter describes the IMAQ Vision for LabWindows/CVI software and associated software products, discusses the documentation and examples available, outlines the IMAQ Vision function organization, and lists the steps for making a machine vision application. Note For information about the system requirements and installation procedure for IMAQ Vision for LabWindows/CVI, see the IMAQ Vision for Measurement Studio Release Notes that came with your software. About I
Resumen del contenido incluido en la página 9
Chapter 1 Introduction to IMAQ Vision Documentation»IMAQ Vision for LabWindows/CVI Function Reference. Example programs—If you want examples of how to create specific applications, go tocvi\samples\vision. Application Notes—If you want to know more about advanced IMAQ Vision concepts and applications, refer to the Application Notes located on the National Instruments Web site at ni.com/appnotes.nsf/ NI Developer Zone (NIDZ)—If you want even more information about developing your vision app
Resumen del contenido incluido en la página 10
Chapter 1 Introduction to IMAQ Vision Table 1-1. IMAQ Vision Function Types Function Type Description Image Functions that create space in memory for images and perform basic image Management manipulation. Memory A function that returns memory you no longer need to the operating system. Management Error Functions that set the current error, return the name of the function in which the Management last error occurred, return the error code of the last error, and clear any pending errors. Acquisiti
Resumen del contenido incluido en la página 11
Chapter 1 Introduction to IMAQ Vision Table 1-1. IMAQ Vision Function Types (Continued) Function Type Description Frequency Functions for the extraction and manipulation of complex planes. Functions of Domain this type perform FFTs, inverse FFTs, truncation, attenuation, addition, Analysis subtraction, multiplication, and division of complex images. Barcode A function that reads a barcode. LCD Functions that find and read seven-segment LCD characters. Meter Functions that return the arc informat
Resumen del contenido incluido en la página 12
Chapter 1 Introduction to IMAQ Vision Creating IMAQ Vision Applications Figures 1-1 and 1-2 illustrate the steps for creating an application with IMAQ Vision. Figure 1-1 describes the general steps to designing a Vision application. The last step in Figure 1-1 is expanded upon in Figure 1-2. You can use a combination of the items in the last step to create your IMAQ Vision application. For more information about items in either diagram, see the corresponding chapter listed to the right of the it
Resumen del contenido incluido en la página 13
Chapter 1 Introduction to IMAQ Vision 1 Define Regions of Interest Chapter 3: Grayscale and Color Measurements Measure Measure Grayscale Statistics Color Statistics 2 3 Locate Objects to Inspect Correct Image Distortion Create a Binary Image Set Search Areas Chapter 4: Find Measurement Points Improve a Binary Image Chapter 5: Blob Analysis Machine Vision Convert Pixel Coordinates to Make Particle Measurements Real-World Coordinates Convert Pixel Coordinates to Make Measurements Real-World Coordi
Resumen del contenido incluido en la página 14
2 Getting Measurement-Ready Images This chapter describes how to set up your 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 your imaging system. The manner in which you set up your system depends on your imaging environment and the type of analysis and processing you need to do. Your imaging system should produce images with high enough qu
Resumen del contenido incluido en la página 15
Chapter 2 Getting Measurement-Ready Images 3. Select an image acquisition device that meets your needs. National Instruments offers several image acquisition (IMAQ) devices, such as analog color and monochrome IMAQ devices as well as digital devices. Visitni.com/imaq for more information about IMAQ devices. 4. Configure the driver software for your image acquisition device. If you have a National Instruments image acquisition device, configure your NI-IMAQ driver software through Measurement & A
Resumen del contenido incluido en la página 16
Chapter 2 Getting Measurement-Ready Images Table 2-1. IMAQ Vision for LabWindows/CVI Image Types Value Description IMAQ_IMAGE_U8 8 bits per pixel—unsigned, standard monochrome IMAQ_IMAGE_I16 16 bits per pixel—signed, monochrome IMAQ_IMAGE_SGL 32 bits per pixel—floating point, monochrome IMAQ_IMAGE_COMPLEX 2 × 32 bits per pixel—floating point, native format after a Fast Fourier Transform (FFT) IMAQ_IMAGE_RGB 32 bits per pixel—standard color IMAQ_IMAGE_HSL 32 bits per pixel—color If you plan to us
Resumen del contenido incluido en la página 17
Chapter 2 Getting Measurement-Ready Images Source and Destination Images Some IMAQ Vision functions that modify the contents of an image have source image and destination image input parameters. The source image receives the image to process. The destination image receives the processing results. The destination image can receive either another image or the original, depending on your goals. If you do not want the contents of the original image to change, use separate source and destination imag
Resumen del contenido incluido en la página 18
Chapter 2 Getting Measurement-Ready Images imaqAdd(myImageA,myImageA,myImageB); This function adds two source images and stores the result in the first source image. imaqAdd(myImageB,myImageA,myImageB); This function adds two source images and stores the result in the second source image. Most operations between two images require that the images have the same type and size. However, some arithmetic operations can work between two different types of images (for example, 8-bit and 16-bit). So
Resumen del contenido incluido en la página 19
Chapter 2 Getting Measurement-Ready Images Acquiring an Image Use one of the following methods to acquire images with a National Instruments image acquisition (IMAQ) device: Acquire a single image usingimaqEasyAcquire(). When you call this function, it initializes the IMAQ device and acquires the next incoming video frame. Use this function for low-speed single capture applications where ease of programming is essential. Acquire a single image usingimaqSnap(). When you call this function, it
Resumen del contenido incluido en la página 20
Chapter 2 Getting Measurement-Ready Images UseimaqReadVisionFile() to open an image file containing additional information, such as calibration information, template information for pattern matching, or overlay information. For more information about pattern matching templates and overlays, see Chapter 5, Machine Vision. You can also useimaqGetFileInfo() to retrieve image properties—image size, recommended image type, and calibration units—without actually reading all the image data. Converting