National Instruments IMAQ Vision for LabWindows TM /CVI manual

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

Ir para a página of

Bom manual de uso

As regras impõem ao revendedor a obrigação de fornecer ao comprador o manual com o produto National Instruments IMAQ Vision for LabWindows TM /CVI. A falta de manual ou informações incorretas fornecidas ao consumidor são a base de uma queixa por não conformidade do produto com o contrato. De acordo com a lei, pode anexar o manual em uma outra forma de que em papel, o que é frequentemente utilizado, anexando uma forma gráfica ou manual electrónicoNational Instruments IMAQ Vision for LabWindows TM /CVI vídeos instrutivos para os usuários. A condição é uma forma legível e compreensível.

O que é a instrução?

A palavra vem do latim "Instructio" ou instruir. Portanto, no manual National Instruments IMAQ Vision for LabWindows TM /CVI você pode encontrar uma descrição das fases do processo. O objetivo do manual é instruir, facilitar o arranque, a utilização do equipamento ou a execução de determinadas tarefas. O manual é uma coleção de informações sobre o objeto / serviço, um guia.

Infelizmente, pequenos usuários tomam o tempo para ler o manual National Instruments IMAQ Vision for LabWindows TM /CVI, e um bom manual não só permite conhecer uma série de funcionalidades adicionais do dispositivo, mas evita a formação da maioria das falhas.

Então, o que deve conter o manual perfeito?

Primeiro, o manual National Instruments IMAQ Vision for LabWindows TM /CVI deve conte:
- dados técnicos do dispositivo National Instruments IMAQ Vision for LabWindows TM /CVI
- nome do fabricante e ano de fabricação do dispositivo National Instruments IMAQ Vision for LabWindows TM /CVI
- instruções de utilização, regulação e manutenção do dispositivo National Instruments IMAQ Vision for LabWindows TM /CVI
- sinais de segurança e certificados que comprovam a conformidade com as normas pertinentes

Por que você não ler manuais?

Normalmente, isso é devido à falta de tempo e à certeza quanto à funcionalidade específica do dispositivo adquirido. Infelizmente, a mesma ligação e o arranque National Instruments IMAQ Vision for LabWindows TM /CVI não são suficientes. O manual contém uma série de orientações sobre funcionalidades específicas, a segurança, os métodos de manutenção (mesmo sobre produtos que devem ser usados), possíveis defeitos National Instruments IMAQ Vision for LabWindows TM /CVI e formas de resolver problemas comuns durante o uso. No final, no manual podemos encontrar as coordenadas do serviço National Instruments na ausência da eficácia das soluções propostas. Atualmente, muito apreciados são manuais na forma de animações interessantes e vídeos de instrução que de uma forma melhor do que o o folheto falam ao usuário. Este tipo de manual é a chance que o usuário percorrer todo o vídeo instrutivo, sem ignorar especificações e descrições técnicas complicadas National Instruments IMAQ Vision for LabWindows TM /CVI, como para a versão papel.

Por que ler manuais?

Primeiro de tudo, contem a resposta sobre a construção, as possibilidades do dispositivo National Instruments IMAQ Vision for LabWindows TM /CVI, uso dos acessórios individuais e uma gama de informações para desfrutar plenamente todos os recursos e facilidades.

Após a compra bem sucedida de um equipamento / dispositivo, é bom ter um momento para se familiarizar com cada parte do manual National Instruments IMAQ Vision for LabWindows TM /CVI. Atualmente, são cuidadosamente preparados e traduzidos para sejam não só compreensíveis para os usuários, mas para cumprir a sua função básica de informação

Índice do manual

  • Página 1

    IMAQ TM IMAQ Vision for LabWindows TM /CVI TM User Manual IMAQ Vision f or LabW indows/CVI User Manual August 2004 Edi tion Part Number 3712 66A-01[...]

  • Página 2

    Support Worldwide Technical Support and Product Info rmation ni.com National Instruments Corporate Headquarters 11500 North Mopac Expressway Aust in, 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, Ca nada ([...]

  • Página 3

    Important Information Warranty The media on which you receive Natio nal In struments software are warranted not to fail to execute p rogramming instruction s, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as eviden ced by receipt s or other documentation. N ational Instruments will , at its option, repa[...]

  • Página 4

    © National Instruments Cor poration v IMAQ Vision for LabWindows/CVI User Manual Contents About This Manual Conventions ............ .............. ........... .............. ............ .............. .............. ........... ............. i x Related Documentation ............ .............. ........... .............. .............. .........[...]

  • Página 5

    Contents IMAQ Vision for LabWindow s/CVI User Manual vi ni.com Chapter 3 Making Grayscale and Color Measurements Define Regions of Interest .............. .............. ........... .............. .............. .............. ............ 3-1 Defining Regions Interactively ................. ... .............. ........... .............. ...........[...]

  • Página 6

    Contents © National Instruments Cor poration vii IMAQ Vision for LabWindows/CVI User Manu al Defining a Search Area .............. .............. ........... .............. .............. .. 5-16 Setting Matching Parameters and Tolerances ..... .............. ................ 5-17 Testing the Search Algorithm on Test Images ..................... .[...]

  • Página 7

    Contents IMAQ Vision for LabWindows/ CVI User Manual viii ni.com Appendix A Technical Support and Professional Services Glossary Index[...]

  • Página 8

    © National Instruments Corporation ix IMAQ Vision for LabWindows/CVI U ser Manual About This Manual The IMAQ Vision for LabWin dows/CVI User Manual is inten ded for engineers and scientists who have kno wledge of the LabW indo ws ™ /CVI ™ programming en vironment and need to create machine vi sion and image processing applications using C func[...]

  • Página 9

    About This Manual IMAQ Vision for LabWindow s/CVI User Manual x ni.com Related Documentation In addition to this manual, the fol lo wing documentatio n resources are av ailable to help you create your vision application. IMAQ Vision • IMAQ Vision C o ncepts Man u al — I f y ou are n e w to m achi n e v i sion and imaging, read this manual to un[...]

  • Página 10

    About This Manual © National Instruments Corporation xi IMAQ Vision for LabWindows/CVI U ser Manual Other Documentation • Y our National Instru ments image acquisition (I MA Q) de vice user manual—If you need installation instructions and device-specif ic information, refer to your device user manual. • Getting St arted With Yo ur IMAQ Syste[...]

  • Página 11

    © National Instruments Corporation 1-1 IMAQ Vision for LabWindows/CVI User Manual 1 Introduction to IMAQ Vision This chapter describes the IMAQ Vision for LabWin dows/CVI software, outlines the IMAQ Vision fu nction organization, and lists the steps for making a machine vision application. Note Refer to the Vision Development Mo dule Release Notes[...]

  • Página 12

    Chapter 1 Introductio n to IMAQ Vision IMAQ Vision for LabWindows/ CVI User Manual 1-2 ni.com IMAQ Vision Function T ree The IMAQ Vision funct ion tree ( NIVision.lfp ) contains separate classes corresponding to groups or type s of functions. Table 1 -1 lists the IMAQ Vision function types and gives a description of each type. Table 1-1. IMAQ Visio[...]

  • Página 13

    Chapter 1 Introductio n to IMAQ Vision © National Instruments Corporation 1-3 IMAQ Vision for LabWindows/CVI User Manual IMAQ Machine Vision Function T ree The IMAQ Machine Vision function tree ( NIMachineVision.fp ) contains separate classes corresponding to g roups or types of functions. Table 1-2 lists the IMAQ Machine Vision function types and[...]

  • Página 14

    Chapter 1 Introductio n to IMAQ Vision IMAQ Vision for LabWindows/ CVI User Manual 1-4 ni.com Creating IMAQ Vision Applications Figures 1-1 and 1-2 illustrate the step s for creating an application with IMAQ Vision. Figure 1-1 describ es the general steps to designing a Vision application. The last step in Figure 1-1 is expanded u pon in Figure 1-2[...]

  • Página 15

    Chapter 1 Introductio n to IMAQ Vision © National Instruments Corporation 1-5 IMAQ Vision for LabWindows/CVI User Manual Figure 1-1. General Steps for Designi ng a Vision Application Note Diagram items enclosed with da shed lines are optional steps. Set Up Y our Imaging System Calibrate Y our Imaging System Create an Image Acquire or Read an Image[...]

  • Página 16

    Chapter 1 Introductio n to IMAQ Vision IMAQ Vision for LabWindows/ CVI User Manual 1-6 ni.com Figure 1-2. Inspection Steps for Building a Vision Application Note Diagram items enclosed with da shed lines are optional steps. Define Regions of Interest Chapter 4: Grayscale and Color Measurements Measure Grayscale Statistics Measure Color Statistics 2[...]

  • Página 17

    © National Instruments Corporation 2-1 IMAQ Vision for LabWindows/CVI User Manual 2 Getting Measurement-Ready Images This chapter describes how to set up your imagin g system, acquire and display an image, analyze the image, and prepare the image for additional processing. Set Up Y our Imaging System Before you acquire, analyze, and process images[...]

  • Página 18

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for LabWindows/ CVI User Manual 2-2 ni.com 3. Select an IMA Q device that meet s your needs. National Instruments of fers se veral IMA Q devices, includi ng analog color and monochrome devices as well as digital de vices. V isit ni.com/imaq for more information about IMA Q devices. 4. Configu[...]

  • Página 19

    Chapter 2 Getting Measurement-Ready Images © National Instruments Corporation 2-3 IMAQ Vision for LabWindows/CVI User Manual Y ou can create multiple images b y ex ecuting imaqCreateImage() as many times as you want. Determine the number of required images through an analysis of your intended application. The decision is based on different process[...]

  • Página 20

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for LabWindows/ CVI User Manual 2-4 ni.com Source and Destination Images Some IMAQ Vision func tions that modify the contents of an image have source image and destination image in put parameters. The source image receives the image to process. Th e destination image recei ves the processing [...]

  • Página 21

    Chapter 2 Getting Measurement-Ready Images © National Instruments Corporation 2-5 IMAQ Vision for LabWindows/CVI User Manual • imaqAdd(myImageA, myImageA, myIma geB); This function adds two source images and stores t he result in the first source image. • imaqAdd(myImageB, myImageA, myIma geB); This function adds two source images and stores t[...]

  • Página 22

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for LabWindows/ CVI User Manual 2-6 ni.com Acquiring an Image Use one of the following methods to acquire images with a Nation al Instruments IMAQ devi ce. • Acquire a single image using imaqEasyAcquire() . When you call this function, it initializes the IMA Q de vice and acquires the next [...]

  • Página 23

    Chapter 2 Getting Measurement-Ready Images © National Instruments Corporation 2-7 IMAQ Vision for LabWindows/CVI User Manual Use imaqReadVisionFile() to open an image file containing additional information, such as calibration info rmation, template inform ation for pattern matching, or overlay information. For more information about pattern match[...]

  • Página 24

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for LabWindows/ CVI User Manual 2-8 ni.com Attach Calibration Information If you want to attach the calibratio n information of the curr ent setup to each image you acquire, use imaqCopyCalibr ationInfo() . This function takes in a source image contai ning the calibration inform ation and a d[...]

  • Página 25

    Chapter 2 Getting Measurement-Ready Images © National Instruments Corporation 2-9 IMAQ Vision for LabWindows/CVI User Manual If the image quality meets your needs, use the histogram to determine the range of pixel v alues that correspond to objects in the image. Y o u can use this range in processing functions, such as determining a threshold rang[...]

  • Página 26

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for LabWindows/CVI U ser Manual 2-10 ni.com Lookup T ables Apply lookup table (LUT) transformati ons to highlight image details in areas containing significan t information at the expense of other areas. A LUT transformation converts in put gr ayscale values in the source image into other gra[...]

  • Página 27

    Chapter 2 Getting Measurement-Ready Images © National Instruments Cor poration 2-11 IMAQ Vision for LabWi ndows/CVI User Manual Convolution Filter The imaqConvolve() function allows you to use a predefined set of lowpass and highpass filters. Each filter is defined by a kernel of coefficients. Use imaqGetKernel() to retrieve predefin ed kernels. I[...]

  • Página 28

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for LabWindows/CVI U ser Manual 2-12 ni.com • Closing—Removes d ark pixels isolated in bright regions and smoot hs boundaries. • Proper -openi ng—Removes brig ht pixels isol ated in dark regio ns and smooths the inner contours of particles. • Proper-closing—Removes dark pixels iso[...]

  • Página 29

    Chapter 2 Getting Measurement-Ready Images © National Instruments Cor poration 2-13 IMAQ Vision for LabWi ndows/CVI User Manual attenuation increases. This oper ation preserv es all of the zero frequency information. Zero frequ ency information correspond s to the DC co mponent of the imag e or the av erage intensity of the image in the spatial do[...]

  • Página 30

    © National Instruments Corporation 3-1 IMAQ Vision for LabWindows/CVI User Manual 3 Making Grayscale and Color Measurements This chapter describes how to take m easurements from grayscale and color images. You can make inspection decisi ons based on image statistics, such as the mean intensity level in a region. Based on the image statistics, you [...]

  • Página 31

    Chapter 3 Making Grayscale and Color Measurements IMAQ Vision for LabWindows/ CVI User Manual 3-2 ni.com T a ble 3-1 describes each of the tool s and the manner in which you use them. Table 3-1. T ools Palette Functions Icon T ool Name Function Selection T ool Select an R OI in the image and adjust the position of its control points and contours. A[...]

  • Página 32

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Corporation 3-3 IMAQ Vision for LabWindows/CVI User Manual Hold down the <Shift> ke y while drawing an R OI to const rain the R OI to the horizontal, vertical, or diagonal axes. Use the Selection T ool to position an R OI by its control points or vertic es. R OIs are c[...]

  • Página 33

    Chapter 3 Making Grayscale and Color Measurements IMAQ Vision for LabWindows/ CVI User Manual 3-4 ni.com Y ou can display the IMA Q V ision tools palette as part of an R OI constructor window or in a separate, floating w indow . Follow these steps to in v oke an R OI constructor and define an R OI from within the R OI constructor window: 1. Use ima[...]

  • Página 34

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Corporation 3-5 IMAQ Vision for LabWindows/CVI User Manual 3. Click OK to populate a struct ure representing the R OI. Y ou can use this structure as an input to a variety of functions, such as the following functions that measure grayscale intensity . • imaqLightMeterPoin[...]

  • Página 35

    Chapter 3 Making Grayscale and Color Measurements IMAQ Vision for LabWindows/ CVI User Manual 3-6 ni.com The following list describes ho w you can display the tools palette in a separate window and manipulate the palette. •U s e imaqShowToolWindow() to display the tools palette in a floating window . •U s e imaqSetupToolWindow() to conf igure t[...]

  • Página 36

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Corporation 3-7 IMAQ Vision for LabWindows/CVI User Manual or a labeled version of the binary im age as a mask image to the intensity measurement functi on. If you want to make color comp arisons, con vert the binary image i nto an R OI descriptor usin g imaqMaskToROI() . Me[...]

  • Página 37

    Chapter 3 Making Grayscale and Color Measurements IMAQ Vision for LabWindows/ CVI User Manual 3-8 ni.com Figure 3-4. Primar y Components of a 32-Bit Color Image Figure 3-5. Primar y Components of a 64-Bit Color Image Use imaqExtractColorPlanes() to extract the red, green, blue, hue saturation, intensity , luminance, or v alue plane of a color image[...]

  • Página 38

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Corporation 3-9 IMAQ Vision for LabWindows/CVI User Manual Comparing Colors You can use the color matching capabilit y of IMAQ Vision to compare or evaluate the color content of an image or regions in an image. Complete the f ollo wing step s to compare co lors using c olor [...]

  • Página 39

    Chapter 3 Making Grayscale and Color Measurements IMAQ Vision for LabWindows/CVI U ser Manual 3-10 ni.com Figure 3-6. T emplate Color Information The following sections explain when to learn the color information associated with an entire image, a reg ion in an image, or multiple regions in an image. Using the Entire Image You can use an entire ima[...]

  • Página 40

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Cor poration 3-11 IMAQ Vision for LabWi ndows/CVI User Manual Figure 3-8. Using a Single Region to Learn Color Distribution Using Multiple Regions in the Image The interaction of light w ith the objec t surface creates the observed color of that object. The color of a surfac[...]

  • Página 41

    Chapter 3 Making Grayscale and Color Measurements IMAQ Vision for LabWindows/CVI U ser Manual 3-12 ni.com Figure 3-9. Using Multiple Regions to Learn Color Distribution Choosing a Color Repr esentation Sensitivity When you learn a color, you need to sp ecify the sensi tivity required to specify the color information. An imag e containing a few, wel[...]

  • Página 42

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Cor poration 3-13 IMAQ Vision for LabWi ndows/CVI User Manual Ignoring Learned Colors Ignore certain color components in color matching by rep lacing the corresponding componen t in the input color spectrum array to –1. For example, by replacing the last component in the c[...]

  • Página 43

    © National Instruments Corporation 4-1 IMAQ Vision for LabWindows/CVI User Manual 4 Performing Particle Analysis This chapter describes how to perfor m particle analysis on you r images. Use particle analysis to find statistical informat ion about particles—such as the area, location, and pres ence of particles. With this i nformation, you can p[...]

  • Página 44

    Chapter 4 Per forming Particle Analysis IMAQ Vision for LabWindows/ CVI User Manual 4-2 ni.com If all the objects in your grayscale image are either brighter or dark er than your background, you can use imaqAutoThreshold() to automati cally determine the optimal threshold range and threshol d your image. Automatic thresholding techniques offer more[...]

  • Página 45

    Chapter 4 Per forming Particle Analysis © National Instruments Corporation 4-3 IMAQ Vision for LabWindows/CVI User Manual Removing Unwanted Particles Use imaqRejectBorder() to remove particles that touch the border of the image. Reject particles on the bo rder of the image when you suspect that the information about tho se particles is incomplete.[...]

  • Página 46

    Chapter 4 Per forming Particle Analysis IMAQ Vision for LabWindows/ CVI User Manual 4-4 ni.com isthmuses while close widen s the isth muses. Close and proper-close fill small holes in the particle. Auto-m edian removes isthm uses and fills holes. Refer to Chapter 9, Binary Morphology , of the I M AQ Vision Concepts Manu a l for m o re in f or m at [...]

  • Página 47

    Chapter 4 Per forming Particle Analysis © National Instruments Corporation 4-5 IMAQ Vision for LabWindows/CVI User Manual IMAQ_MT_BOUNDING_RECT_LEFT X-coordinate of the leftmost particle point IMAQ_MT_BOUNDING_RECT_RIGHT X-coordinate of the rightmost particle po int IMAQ_MT_BOUNDING_RECT_HEIGHT Distance between the y-coordinate of highest particle[...]

  • Página 48

    Chapter 4 Per forming Particle Analysis IMAQ Vision for LabWindows/ CVI User Manual 4-6 ni.com IMAQ_MT_EQUIVALENT_ELLIPSE_MAJOR_AXIS Length of the major axis of the ellipse with the same perimeter and area as the particle IMAQ_MT_EQUIVALENT_ELLIPSE_MINOR_AXIS Len gth of the minor axis o f the ellipse with the same perimeter and area as the particle[...]

  • Página 49

    Chapter 4 Per forming Particle Analysis © National Instruments Corporation 4-7 IMAQ Vision for LabWindows/CVI User Manual IMAQ_MT_HU_MOMENT_5 Fifth Hu moment IMAQ_MT_HU_MOMENT_6 Sixth Hu mome nt IMAQ_MT_HU_MOMENT_7 Se v enth Hu moment IMAQ_MT_HEYWOOD_CIRCULARITY_FACTOR Perimeter di vided b y the circumference of a circle with the same area IMAQ_MT[...]

  • Página 50

    Chapter 4 Per forming Particle Analysis IMAQ Vision for LabWindows/ CVI User Manual 4-8 ni.com IMAQ_MT_MAX_FERET_DIAMETER_START_Y Y -coordinate of the start of the line segment connecting the tw o perimeter points that are the furthest apart IMAQ_MT_MAX_HORIZ_SEGMENT_LENGTH_LEFT X-coordinate of the leftmost pixel in the longest row of contiguous pi[...]

  • Página 51

    Chapter 4 Per forming Particle Analysis © National Instruments Corporation 4-9 IMAQ Vision for LabWindows/CVI User Manual IMAQ_MT_NORM_MOMENT_OF_INERTIA_XXX Normaliz ed moment of inertia in the x direction three times IMAQ_MT_NORM_MOMENT_OF_INERTIA_XXY Normaliz ed moment of inertia in the x direction twice and the y directio n once IMAQ_MT_NORM_MO[...]

  • Página 52

    Chapter 4 Per forming Particle Analysis IMAQ Vision for LabWindows/CVI U ser Manual 4-10 ni.com IMAQ_MT_SUM_XX Sum of all x-coordinates squared in the particle IMAQ_MT_SUM_XY Sum of all x-coordinates multiplied by y-coordinates in the particle IMAQ_MT_SUM_YY Sum of all y-coordinates squared in the particle IMAQ_MT_SUM_XXX Sum of all x-coordinates c[...]

  • Página 53

    © National Instruments Corporation 5-1 IMAQ Vision for LabWindows/CVI User Manual 5 Performing Machine Vision Ta s k s This chapter describes how to perform many common machi ne vision inspection tas ks. The most common inspection tasks are detecting the presence or absence of parts in an image an d measuring the dim ensions of parts to see if the[...]

  • Página 54

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/ CVI User Manual 5-2 ni.com Figure 5-1 ill ustrates the basic st eps involved in perfor ming machine visio n inspection tas ks. Figure 5-1. Steps to Performing Machine Vision Note Diagram items enclosed with da shed lines are optional steps. Locate Objects to Inspect In a typic[...]

  • Página 55

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-3 IMAQ Vision for LabWindows/CVI User Manual it appears shifted and rotated in the image you need to process. This coordinate system is referred to as the measurement co ordinate system. The measurement methods automatically mov e the R OIs to the correct position usi[...]

  • Página 56

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/ CVI User Manual 5-4 ni.com Using Edge Detection to Build a Coordinate T ransform You can build a coordinate transform using two edge detection techn iques. Use imaqFindTransformRect() to define a coordinate system using one rectangular region. Use imaqFindTransformRects() to d[...]

  • Página 57

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-5 IMAQ Vision for LabWindows/CVI User Manual b . If you use imaqFindTransformRects() , specify two rectangular objects, each contai ning one separate, straight boundary of the object, as shown in Figure 5-3. The boundaries cannot be parallel. The regions must be large[...]

  • Página 58

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/ CVI User Manual 5-6 ni.com Using Pattern Matching to Bu ild a Coordinate T r ansform You can build a coordinate transform using patt ern matching. Use imaqFindTransformPattern() to define a coordinate system based on the location of a reference feature. Us e this technique whe[...]

  • Página 59

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-7 IMAQ Vision for LabWindows/CVI User Manual Choosing a Method to Build the Coordinate T ransform Figure 5-4 guides you through cho osing the best method for bui lding a coordinate transform for your appl ication. Figure 5-4. Building a Coordinate T ransform Start Ye [...]

  • Página 60

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/ CVI User Manual 5-8 ni.com Set Search Areas You use ROIs to define search areas in your images and limit the areas in which you perform your processing and inspection. You can define ROIs interactivel y or programmati cally. Defining Regions Interactively Complete the f ollowi[...]

  • Página 61

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-9 IMAQ Vision for LabWindows/CVI User Manual Defining Regions Programmatically When you have an automated application, you need to define ROIs programmatically. You can programmatical ly define regions in two ways: • Specify the contours of the R OI. • Specify ind[...]

  • Página 62

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-10 ni.com Finding Lines or Circles If you want to find points along the edge of an object and find a line describing the edge, use imaqFindEdge() and imaqFindConcentricEdges() . The imaqFindEdg e() function finds edges based on rectangular search areas, as sh[...]

  • Página 63

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-11 IMAQ Vision for LabWi ndows/CVI User Manual If you want to find points along a circular edge an d find the circle that best fits the edge, as sho wn in Figure 5-6, use imaqFindCircularEdge() . Figure 5-6. Finding a Cir cular Feature Use imaqFindEdge() and imaqFind[...]

  • Página 64

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-12 ni.com These functions require you to input th e coordinates of the points along the search contour . Use imaqROIProfile() to obtain the coordinates along the edge of each contour in an R OI. If you hav e a straight line, use imaqGetPointsOnLine() to obtai[...]

  • Página 65

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-13 IMAQ Vision for LabWi ndows/CVI User Manual Finding Points Usin g Pattern Matching The pattern matching algorithms in IM A Q V ision measure the similarity between an idealized representation of a feature, called a template, and the feature that may be presen t in[...]

  • Página 66

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-14 ni.com Symmetry A rotationally symmetric temp late, shown in Fig ure 5-7a, is less sensi tive to changes in rotation than one that is rotat ionally asymmetric, shown in Figure 5-7b. A rotati onally symmetric temp late provides good position ing information[...]

  • Página 67

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-15 IMAQ Vision for LabWi ndows/CVI User Manual Positional Information A template with strong edges in both th e x and y directions is easier to locate. Figure 5-9a sho ws good posi tional information in both t he x and y directions, whi le Figure 5-9b sho ws insuffic[...]

  • Página 68

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-16 ni.com the template that are necessary for shift-inv ariant matching. Howe ver, if you want to match the template at any ori entation, use rotation-invariant matching. Use the lear ningMode parameter of imaqLearnPattern2() to specify which type of learning[...]

  • Página 69

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-17 IMAQ Vision for LabWi ndows/CVI User Manual Figure 5-11. S electing a Sear ch Area for Grayscale P attern Matching Setting Matching Parameters and T olerances Every pattern matching algor ithm makes assumptions about th e images and pattern matching parameters use[...]

  • Página 70

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-18 ni.com Minimum Contrast The pattern matching algorit hm ignores all image region s in which contrast values fall below a set minimum contrast value. Contrast is the difference between the smallest and largest pi xel va lues in a region. Set the minContrast[...]

  • Página 71

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-19 IMAQ Vision for LabWi ndows/CVI User Manual Using a Ranking Method to V erify Results The manner in which you interp ret the pattern matching algo rithm depends on your application. For typ ical alignm ent applications, such as finding a fiducial on a wafer, the m[...]

  • Página 72

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-20 ni.com 5. Set the t olerances and p arameters to specify h ow t he algorithm operates at run time using the options parameter of imaqMatchColorPattern() . 6. T est the search algorith m on test images using imaqMatchColorPattern() . 7. V erify the results [...]

  • Página 73

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-21 IMAQ Vision for LabWi ndows/CVI User Manual Background Information Unique background information in a template improves search performance and accuracy during the grayscale pattern matching phase. This requirement could conflict with the color information requirem[...]

  • Página 74

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-22 ni.com Defining a Search Area Two equally important factors define the success of a color pattern matching algorithm—accuracy and speed . You can define a search area to reduce ambiguity in the search proce ss. For example, if your image has multiple ins[...]

  • Página 75

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-23 IMAQ Vision for LabWi ndows/CVI User Manual The time required to locate a pattern in an image depends on both the template size and the search area. By reducing the search area or increasing the template size, you can reduce the required search time. Increasing th[...]

  • Página 76

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-24 ni.com Choose from the followi ng search strategies: • IMAQ_CONSERVATIVE —Uses a very small ste p size, the least amount of subsampling, and all the color in formation present in the tem plate. The conservati v e strategy is the most reliable method to[...]

  • Página 77

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-25 IMAQ Vision for LabWi ndows/CVI User Manual Rotation Angle Ranges Refer to the Setting Matchin g Parameters a nd Tolerances section of this chapter for informati on about rotation angle ran ges. T esting the Search Algorithm on T e st Images To determine if your s[...]

  • Página 78

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-26 ni.com 6. T est the color location algorithm on test images using imaqMatchColorPattern() . 7. V erify the results using a ranking method. Y ou can sav e the template image using imaqWriteV isionFile() . Convert Pixel Coordinates to Real-W orld Coordinates[...]

  • Página 79

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-27 IMAQ Vision for LabWi ndows/CVI User Manual Analytic Geometr y Measurements Use the following functions to make geometrical measurements from the points you detect in the image: • imaqFitLine() — Fits a line to a set of points and comp utes the equation of the[...]

  • Página 80

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-28 ni.com Use imaqFindLCDSegments() to calculate the R OI around each digit in an LCD or LED. T o find the area of each digit, all the segments of the indicator must be activ ated. Use imaqReadLCD () to read multip le digits of an LCD or LED. Identify Parts U[...]

  • Página 81

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-29 IMAQ Vision for LabWi ndows/CVI User Manual The following code sample provides an example of a typical classif ication application. ClassifierSession* session; Image* image; ROI* roi; char* fileName; // The classifier fi le to use. ClassifierReport* report; sessio[...]

  • Página 82

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-30 ni.com Reading Barcodes Use barcode reading functions to read values encoded int o 1D barcodes, Data Matrix barcodes, and PDF417 barcodes. Reading 1D Barcodes To read a 1D barcode, locate the barcode in the image using one of the techniques described in th[...]

  • Página 83

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-31 IMAQ Vision for LabWi ndows/CVI User Manual By default, imaqReadDataMatrixBarcode() assumes the barcode cells are square. If the barcodes you need to read hav e round cells, set the cellShape element of the options paramet er to IMAQ_ROUND_CELLS . Note Specify rou[...]

  • Página 84

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for LabWindows/CVI U ser Manual 5-32 ni.com Use the following functions to ov erlay search re gions, inspection results, and other information, such as text and bitmaps. • imaqOverlayPoints() — Overlays points on an image. Specify a point by its x-coordinate and y-coordinate. • imaqOver[...]

  • Página 85

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-33 IMAQ Vision for LabWi ndows/CVI User Manual The following list contains the kinds of information you can overlay with the pre vious functions except imaqFindPattern() , imaqCountObjects() , and imaqFindTransformPatte rn() . • The search area input into the funct[...]

  • Página 86

    © National Instruments Corporation 6-1 IMAQ Vision for LabWindows/CVI User Manual 6 Calibrating Images This chapter describes how to calibrate yo ur imaging system, save calibration information , and attach calibration in formation to an image. After you set u p your imaging system , you may want to cal ibrate your system. If your imaging setup is[...]

  • Página 87

    Chapter 6 Calibrating Images IMAQ Vision for LabWindows/ CVI User Manual 6-2 ni.com Refer to Chapter 5, Performing Machine Vision Tasks , fo r more information about applying calibratio n information before making measurements. Defining a Calibration T emplate You can define a calibration tem plate by supply ing an image of a grid or providing a li[...]

  • Página 88

    Chapter 6 Calibr ating Images © National Instruments Corporation 6-3 IMAQ Vision for LabWindows/CVI User Manual Defining a Reference Coordinate System To express measurements in real-w orld units, you need to d efine a coordinate system in the imag e of the grid. Use the CoordinateSystem structure to define a coordinate sy stem by its origin, angl[...]

  • Página 89

    Chapter 6 Calibrating Images IMAQ Vision for LabWindows/ CVI User Manual 6-4 ni.com Figure 6-3. A Calibration Grid and an Image of the Grid Note If you specify a list of points instead of a grid for the calibration process, the software def ines a default coordinate system, as follo ws: 1. The origin is placed at the point in the li st with the lo [...]

  • Página 90

    Chapter 6 Calibr ating Images © National Instruments Corporation 6-5 IMAQ Vision for LabWindows/CVI User Manual Figure 6-4. Defining a Coordinate System Learning Calibration Information After you define a calibration grid and reference axis, acquire an image of the grid using the current imaging se tup. For information about acqu iring images, ref[...]

  • Página 91

    Chapter 6 Calibrating Images IMAQ Vision for LabWindows/ CVI User Manual 6-6 ni.com Specifying Scaling Factors Scaling factors are the real-world distances between the dots in the calibration grid in the x and y direction s and the units in which the distances are measured. Use the GridDescriptor structure to specify the scaling factors. Choosing a[...]

  • Página 92

    Chapter 6 Calibr ating Images © National Instruments Corporation 6-7 IMAQ Vision for LabWindows/CVI User Manual Choose the perspecti ve projection algo rithm when your system exhibits perspecti ve errors only . A perspectiv e projection calibration has an accurate transformation e ven in areas not co ve red by the calibration grid, as sho wn in Fi[...]

  • Página 93

    Chapter 6 Calibrating Images IMAQ Vision for LabWindows/ CVI User Manual 6-8 ni.com If the learning process returns a learni ng score below 600, try the follo wing: 1. Make sure your grid co mplies with t he guidelines listed in the Defining a Calibration Tem plate section of this chapter . 2. Check the lighting condition s. If you have too much or[...]

  • Página 94

    Chapter 6 Calibr ating Images © National Instruments Corporation 6-9 IMAQ Vision for LabWindows/CVI User Manual Simple Calibration When the axis of your camera is perpendicular to the image plane and lens distortion is negligibl e, use simple calibration. In simpl e calibration, a pixel coordinate is transformed to a real-wor ld coordinate through[...]

  • Página 95

    Chapter 6 Calibrating Images IMAQ Vision for LabWindows/CVI U ser Manual 6-10 ni.com Save Calibration Information After you learn th e calibration informatio n, you can save it so that yo u do not have to relearn the informatio n for subsequent processing. Use imaqWriteVisionFile() to save the image of the grid and its associated calibration inform[...]

  • Página 96

    © National Instruments Corporation A-1 IMAQ Vision for LabWi ndows/CVI User Manual A T echnical Support and Professional Ser vices Visit the following sections of the National Instruments Web site at ni.com for technical support an d professional services: • Support —Online technical support resources at ni.com/support include the following: ?[...]

  • Página 97

    © National Instruments Corporation G-1 IMAQ Vision for LabWind ows/CVI User Manual Glossar y Numbers 1D One-dimensional. 2D T wo-dimensional. 3D Three-dimensional. A AIPD The National Instrument s internal image file format used for saving complex images and calib ration information associ ated with an image (extension APD). alignment The process [...]

  • Página 98

    Glossary IMAQ Vision for LabWindows/ CVI User Manual G-2 ni.com barycenter The grayscale value repres enting the centroid of the range of an image’ s grayscale v alues in the image histogram. binary image An image in which the objects usually have a pix el intensity of 1 (or 255) and the background has a pixel intensity of 0. binary morphol ogy F[...]

  • Página 99

    Glossary © National Instruments Corporation G-3 IMAQ Vision for LabWind ows/CVI User Manual C caliper (1) A function in the NI V ision Assistant and in NI V ision Buil der for Automated Inspection that calculates di stances, angles, circular f its, and the center of mass based on positio ns giv en by edge detection, particle analysis, centroid, an[...]

  • Página 100

    Glossary IMAQ Vision for LabWindows/ CVI User Manual G-4 ni.com connecti vity-4 O nly pixels adjacent in the horizon tal and v ertical direc tions are considered neighbors. connecti vity-8 A ll adjacent pixe ls are considered neighbors. contrast A constant multiplication factor applied to the lu ma and chroma components of a color pixel in the colo[...]

  • Página 101

    Glossary © National Instruments Corporation G-5 IMAQ Vision for LabWind ows/CVI User Manual edge steepness The number of pixels that corr esponds to the slope or transition area of an edge. energy center The center of mass of a grayscale image. See also center of mass . equalize function See histogram equalization . erosion Reduces the size of an [...]

  • Página 102

    Glossary IMAQ Vision for LabWindows/ CVI User Manual G-6 ni.com gradient filter An edge detection algorithm that extracts the contours in gray-le vel v alues. Gradient filters include the Pr e witt and Sobel filters. gray lev el The brightness of a pixel in an image. gray-lev el dilation Increases the brightness of pi xels in an image that are surr[...]

  • Página 103

    Glossary © National Instruments Corporation G-7 IMAQ Vision for LabWind ows/CVI User Manual hit-miss function Locates objects in the image similar to the patt ern defined in the structuring element. HSI A color encoding scheme in hue, saturation, and intensity . HSL A color encoding scheme using hue, saturation, and luminance information where eac[...]

  • Página 104

    Glossary IMAQ Vision for LabWindows/ CVI User Manual G-8 ni.com image enhancement The process of improving the quality of an i mage that you acqu ire from a sensor in terms of signal-to-noise ratio, imag e contrast, edge definition, and so on. image file A f ile containing pixel data and additional information about the image. image format Defines [...]

  • Página 105

    Glossary © National Instruments Corporation G-9 IMAQ Vision for LabWind ows/CVI User Manual intensity calibration A ssigns user -defined quantities such as optical densities or concentrations to the gray-le vel v alues in an image. intensity profile The gray-lev el distribution of the pix els along an R O I in an image. intensity range Defines the[...]

  • Página 106

    Glossary IMAQ Vision for LabWindow s/CVI User Manual G-10 ni.com line gauge Measures the distance between selected edges with hig h-precision subpixel accuracy along a line in an image. For e xample, this function can be used to measure distances between points and edges. This function also can step and repeat its measurements across the image. lin[...]

  • Página 107

    Glossary © National Instruments Cor poration G-11 IMAQ Vision for LabWindows/CVI User Manu al luminance See luma . LUT Lookup table. A table containing v alu es used to transform the gray-le v el v alues of an image. For each gray -lev el v alue in the image, the corresponding new v alue is obtained from the lookup table. M M (1) Mega, the standar[...]

  • Página 108

    Glossary IMAQ Vision for LabWindow s/CVI User Manual G-12 ni.com N neighbor A pixel whose v alue af fects the v alue of a nearb y pix el when an image is processed. The neighbors of a pixel are usually def ined by a k ernel or a structuring element. neighborhood operations Operations on a point in an image that take into considerat ion the values o[...]

  • Página 109

    Glossary © National Instruments Cor poration G-13 IMAQ Vision for LabWindows/CVI User Manu al of fset The coordinate positi on in an imag e where you want to place the origin of another image. Setting an offset is useful when performing mask operations. opening An erosion followed b y a dilation. An openin g removes small objects and smooths bound[...]

  • Página 110

    Glossary IMAQ Vision for LabWindow s/CVI User Manual G-14 ni.com PNG Portable Network Graphic. An image file format for storing 8-bit, 16-bit, and color images with lossless compre ssion. PNG images ha ve the f ile extension PNG . Prewitt filter An edge detection algorith m that extracts the contours in gray-lev el v alues using a 3 × 3 filter ker[...]

  • Página 111

    Glossary © National Instruments Cor poration G-15 IMAQ Vision for LabWindows/CVI User Manu al R OI Region of inter est. (1) An area of the image that is graphically selected from a windo w displaying the image. This area can be used focus further processing. (2) A hardware-program mable rectangular portion of the acquisition window . R OI tools A [...]

  • Página 112

    Glossary IMAQ Vision for LabWindow s/CVI User Manual G-16 ni.com spatial filters Alter the intensity of a pixel relative to variations in intensities of its neighboring pixels. Y ou can use these filters for edge detection, image enhancement, noise reduction, smoothing, and so forth. spatial resolution The number of pix els in an image, in terms of[...]

  • Página 113

    Glossary © National Instruments Cor poration G-17 IMAQ Vision for LabWindows/CVI User Manu al V v alue The grayscale intensity of a color pixel computed as the av erage of the maximum and min imum red, green, an d blue v alues of that pixel. VI V irtual Instrument. (1) A combination of hard ware and/or software elements, typically used with a PC, [...]

  • Página 114

    © National Instruments Corporation I-1 IMAQ Vision for LabWindows/CVI User Manual Index Numerics 1D barcodes, reading, 5-30 2D arrays, converting to images, 2-5, 2-7 A acquiring, images, 2-5 analyzing components of color images, 3-7 images, 2-8 particles, 4-1 applications, creating Vision , 1-4 applying, LUTs, 2-10 applying to images, 2-10 arrays,[...]

  • Página 115

    Index IMAQ Vision for LabWindows/ CVI User Manual I-2 ni.com color information learning, 3-9 specifying, 3-9 color location, using to find points, 5-25 color representation sensitivity, specifying, 3-12 color score weight, 5-24 comparing, color content in images, 3-9 computing energy center of an image, 3-7 energy center of an ROI in an image, 3-7 [...]

  • Página 116

    Index © National Instruments Corporation I-3 IMAQ Vision for LabWindows/CVI User Manual error maps, learning, 6-8 examples (NI resources), A-1 external windows, displaying im ages, 2-7 extracting, planes of color images, 3-8 F Fast Fourier Transform, 2-12 features, finding in images, 5- 13 FFT, 2-12 filtering grayscale features of an image, 2-11 i[...]

  • Página 117

    Index IMAQ Vision for LabWindows/ CVI User Manual I-4 ni.com improving binary images, 4-2 improving sharpn ess of transitions, 2-10 inspecting, 2-8 learning color info rmation, 3-9 learning the color distribution , 3-10 loading from file, 2-5 measuring light intensity, 3-7 modifying complex im ages, 2-13 processing components, 3-7 reading, 2-5 read[...]

  • Página 118

    Index © National Instruments Corporation I-5 IMAQ Vision for LabWindows/CVI User Manual N National Instruments support and services, A-1 NI Vision Assistant, x NI Vision Builder for Automated I nspection, x NI-IMAQ, xi Nth order fi lter, 2-11 O objects, 5-2 inspecting, 5-2 locating, 5-2 open operation, 4-3 opening, particles, 4-3 P particle analys[...]

  • Página 119

    Index IMAQ Vision for LabWindows/ CVI User Manual I-6 ni.com search algorithm, testing, 5-18, 5-25 search areas, 5-10 defining, 5-16, 5-22 ROIs, defining search areas, 5-8 search strategies, se lecting for pattern matching, 5-23 selecting, pattern match ing search strategies, 5-23 separating, touching particles, 4-3 setting color sensitivity, 5-23 [...]