National Instruments IMAQTM 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
120
121

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 IMAQTM. 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 IMAQTM 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 IMAQTM 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 IMAQTM, 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 IMAQTM deve conte:
- dados técnicos do dispositivo National Instruments IMAQTM
- nome do fabricante e ano de fabricação do dispositivo National Instruments IMAQTM
- instruções de utilização, regulação e manutenção do dispositivo National Instruments IMAQTM
- 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 IMAQTM 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 IMAQTM 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 IMAQTM, 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 IMAQTM, 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 IMAQTM. 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 Visual Basic User Manual IMAQ Vision for Visual Basic User Manual August 2004 Edi tion Part Number 3712 57A-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 Visual Basic User Manual Contents About This Manual Conventions ............ .............. ........... .............. ............ .............. .............. ........... ............. i x Related Documentation ............ .............. ........... .............. .............. ...........[...]

  • Página 5

    Contents IMAQ Vision for Visual Basic User Manual vi ni.com Improve an Image ............... .............. ............... ........... .............. .............. ........... ............ 2-9 Lookup Tables ............ ........................................................ ............ ........... ...... 2-9 Filters ..... .............. ......[...]

  • Página 6

    Contents © National Instruments Cor poration vii IMAQ Vision for Visual Basic User Manual Set Search Areas ............. .............. ............ .............. ........... .............. .............. ............ .... 5-8 Defining Regions Interactivel y................. .............. ........... .............. ............ .... 5-8 Defining[...]

  • Página 7

    Contents IMAQ Vision for Visual Basic User Manual viii ni.com Chapter 6 Calibrating Images Perspective and Nonl inear Distortion Calibration ........... ............... ........... .............. ...... 6-1 Defining a Calibration Template............ .............. ............ .............. .............. ... 6-2 Defining a Reference Coordi nate [...]

  • Página 8

    © National Instruments Corporation ix IMA Q Vision for Visual Basic User Manual About This Manual The IMAQ Vision for Visual Basic User Manual is intended for engineers and scientists who have knowledge of Microsoft V isual Basic and need to create machine vision and image proce ssing applications using V isual Basic objects. The manual guides yo [...]

  • Página 9

    About This Manual IMAQ Vision for Visual Basic User Manual x ni.com Related Documentation This manual assumes that you are fami liar with V isual Basic and can us e Activ eX controls in V isual Basi c. The following are good sources of information about V isual Basic and Acti veX controls: • msdn.microsoft.com • Documentation that accompanie s [...]

  • Página 10

    About This Manual © National Instruments Corporation xi IMA Q Vision for Visual Basic User Manual • NI Vision Builder for Automated Inspection: Inspection Help —If you need information about ho w to ru n an automated vision inspection system using NI V ision Builder AI, refer to this help file. Other Documentation • NI OCR Training Interface[...]

  • Página 11

    © National Instruments Cor poration 1-1 IMAQ Vision for Visual Bas ic User Manual 1 Introduction to IMAQ Vision This chapter describes the IMA Q V ision for V isual Basic software and associated software products, disc usses the documentation and examples av ailable, outlines the IMA Q V ision fo r V isual Basic architecture, and lists the steps f[...]

  • Página 12

    Chapter 1 Introductio n to IMAQ Vision IMAQ Vision for Visual Basic User Manual 1-2 ni.com In addition to this manual, several documentation resources are a v ailable to help you create a vision applicati on: • IMAQ Vision Concepts Manual —If you are new to machine vision and imaging, read this manual to understand the concepts behind IMA Q V i[...]

  • Página 13

    Chapter 1 Introductio n to IMAQ Vision © National Instruments Cor poration 1-3 IMAQ Vision for Visual Bas ic User Manual cwimaq.ocx cwimaq.ocx contains the following th ree ActiveX controls and a collection of ActiveX object s: CWIMAQ, CWIMAQVision, and CWIMAQViewer. Refer to the ActiveX Objects section for information about the ActiveX objects. C[...]

  • Página 14

    Chapter 1 Introductio n to IMAQ Vision IMAQ Vision for Visual Basic User Manual 1-4 ni.com niocr .ocx niocr.ocx provides one ActiveX control and a collection of Activ eX objects you use in a machine visi on appl ication to perform optical character recognition (OCR). NIOCR control Use this control to perform OCR, which is the process by which the m[...]

  • Página 15

    Chapter 1 Introductio n to IMAQ Vision © National Instruments Cor poration 1-5 IMAQ Vision for Visual Bas ic User Manual Tip Refer to the source code of the CWMachi neV ision cont rol for an example of how to use the CWIMA QV ision methods. ActiveX Objects Use the objects to group related input p arameters and output param eters to certain methods[...]

  • Página 16

    Chapter 1 Introductio n to IMAQ Vision IMAQ Vision for Visual Basic User Manual 1-6 ni.com Figure 1-1. General Steps for Designi ng a Vision Application Set Up Y our Imaging System Calibrate Y our Imaging System Create an Image Acquire or Read an Image Display an Image Attach Calibration Information Analyze an Image Improve an Image Make Measuremen[...]

  • Página 17

    Chapter 1 Introductio n to IMAQ Vision © National Instruments Cor poration 1-7 IMAQ Vision for Visual Bas ic User Manual Figure 1-2. Inspection Steps for Building a Vision Application Define Regions of Interest Chapter 3: Making Grayscale and Color Measurements Measure Grayscale Statistics Measure Color Statistics 2 Create a Binary Image Improve a[...]

  • Página 18

    © National Instruments Cor poration 2-1 IMAQ Vision for Visual Bas ic User Manual 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 Y our Imaging System Before you acquire, anal yze, and process images ,[...]

  • Página 19

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for Visual Basic User Manual 2-2 ni.com color and monochro me devices as well as digital devices. V isit ni.com/imaq for more information about IMA Q de vices. 4. Configure the dri v er software fo r the image acquisition de vice. If you hav e a National Instruments im age acquisition device,[...]

  • Página 20

    Chapter 2 Getting Measurement-Ready Images © National Instruments Cor poration 2-3 IMAQ Vision for Visual Bas ic User Manual • Complex • 32-bit RGB • 32-bit HSL • 64-bit RGB When you create an image, it is an 8- bit image by default. Y ou can set th e Type property on the image o bject to change the image type. When you create an image, no[...]

  • Página 21

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for Visual Basic User Manual 2-4 ni.com Acquire or Read an Image After you create an image, you can acquire an image into the imagi ng system in one of the following three ways: • Acquire an image with a camera through the image acqu isition device. • Load an image from a file stored on t[...]

  • Página 22

    Chapter 2 Getting Measurement-Ready Images © National Instruments Cor poration 2-5 IMAQ Vision for Visual Bas ic User Manual If you want to acquire multiple frames , set the image count to the number of frames you want to acquire. This operation is called a sequence . Use a sequence for applications that process multip le images. The following cod[...]

  • Página 23

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for Visual Basic User Manual 2-6 ni.com Private Sub Stop_Click() CWIMAQ1.Stop End Sub Reading a File Use the CWIMAQVision.ReadImage method to open and read data from a file stored on the comp uter into the image refe rence. You can read from image files stored in several standard formats , su[...]

  • Página 24

    Chapter 2 Getting Measurement-Ready Images © National Instruments Cor poration 2-7 IMAQ Vision for Visual Bas ic User Manual the vie wer . Y ou can set the CWIMAQPalette.Type property to apply predefined color palettes . For ex ample, if you need t o display a binary image—an image that cont ains particle regions with pixel values of 1 and a bac[...]

  • Página 25

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for Visual Basic User Manual 2-8 ni.com Use CWIMAQVision.Histogram2 to analyze the ov erall grayscale distribution in the image. Use the histogram of the image to analyze two important criteria that define the quality of an image—saturati on and contrast. If the image does not have enough l[...]

  • Página 26

    Chapter 2 Getting Measurement-Ready Images © National Instruments Cor poration 2-9 IMAQ Vision for Visual Bas ic User Manual Improve an Image Using the information you gathered from analyzing the image, yo u may want to improve the quality o f the image for inspection. You can im prove the image with lookup tables, filters, grayscale morph ology, [...]

  • Página 27

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for Visual Basic User Manual 2-10 ni.com Highpass filters emphasize details, such as edges, object boundaries, or cracks. These details represent sharp transitions in int ensity value. Y ou can define your o wn highpass filter with CWIMAQVision.Convolute or CWIMAQVision.NthOrder , or you can [...]

  • Página 28

    Chapter 2 Getting Measurement-Ready Images © National Instruments Corporation 2-11 IMA Q Vision for Visual Bas ic User Manual Use CWIMAQVision.GrayMorphology to perform one of the follo wing se ven transformations: • Erosion—Reduces the brightness of pixels that are surrounded by neighbors with a lower intensity . • Dilation—Increases the [...]

  • Página 29

    Chapter 2 Getting M easure ment-Ready Images IMAQ Vision for Visual Basic User Manual 2-12 ni.com 2. Improv e the image in the frequency domain with a lo wpass or highpass frequency f ilter . Speci fy which type of filter to use with CWIMAQVision.CxAttenuate or CWIMA QVision.CxTruncate . Lowpass f ilters smooth noise, details, textures, and sharp e[...]

  • Página 30

    © National Instruments Cor poration 3-1 IMAQ Vision for Visual Bas ic 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 Visual Basic User Manual 3-2 ni.com Table 3-1. T ools Palette Functions To o l N a m e Function None Disable the tools. Selection T ool Select an R OI in the imag e and adjust the position of its control poin ts and contours. Action: Click the appropriate ROI or control points. Point[...]

  • Página 32

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Cor poration 3-3 IMAQ Vision for Visual Bas ic User Manual Hold down <Shift> when drawing an R O I if you want to constrain the R OI to the horizontal, vertical, or di agonal axes, when possible. Use the selection tool to posit ion an R OI by its control points or vert[...]

  • Página 33

    Chapter 3 Making Grayscale and Color Measurements IMAQ Vision for Visual Basic User Manual 3-4 ni.com Figure 3-2. T ools Information 1 Anchoring Coordinates of a Region of Interest 2 Size of the Image 3 Zoom Factor 4 Image Type Indicator (8-bit, 16-bit, Float, RGB32, RGBU64, HSL, Complex) 5 Pixel Intensity 6 Coordinates of the Mouse 7 Size of an Ac[...]

  • Página 34

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Cor poration 3-5 IMAQ Vision for Visual Bas ic User Manual During design time, use the Menu property page to select wh ich tools appear in the right-click menu. Y ou al so can designate a defa ult tool from this pro perty page. During ru n time, set t he CWIMAQViewer.MenuIt [...]

  • Página 35

    Chapter 3 Making Grayscale and Color Measurements IMAQ Vision for Visual Basic User Manual 3-6 ni.com CWIMA QRegion contains. When you kn ow the type of shape that the region contains, you can set the region into a shape v ariable and use that variable to manipulate the shape pr operties. F or example, the follo wing code resizes a rectangle select[...]

  • Página 36

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Cor poration 3-7 IMAQ Vision for Visual Bas ic User Manual minimum in tensity , and maximum int ensity . Use CWMachineVision.LightMeterRectangle to get the pixel value statistics within a rectangular region in an image. Use CWIMAQVision.Quantify to obtain the follo wing stat[...]

  • Página 37

    Chapter 3 Making Grayscale and Color Measurements IMAQ Vision for Visual Basic User Manual 3-8 ni.com Figure 3-3. Primary Components of an 32-bit Color Image Figure 3-4. Primar y Components of a 64-bit Color Image A color pixel encoded as a Long v alue can be decomposed into its individual components using CWIMAQVision.IntegerToCo lorValue . Y ou c[...]

  • Página 38

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Cor poration 3-9 IMAQ Vision for Visual Bas ic 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 Visual Basic User Manual 3-10 ni.com Specifying the Color Information to Learn Because color matching only uses colo r information to measure similarity, the image or regions in the image representing the object should contain only the significant colors that represent the object, as[...]

  • Página 40

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Corporation 3-11 IMA Q Vision for Visual Bas ic User Manual Using a Region in the Image You can select a region in the image t o provide th e color inform ation for comparison. A region is helpful for pul ling out the useful color information in an image. Figure 3-7 shows an[...]

  • Página 41

    Chapter 3 Making Grayscale and Color Measurements IMAQ Vision for Visual Basic User Manual 3-12 ni.com fuses much better and results in hi gh match scores—around 800 —for both the fuses. Y ou can use an unlimited number of samples to learn the representati ve color spectrum for a specif ied template. Figure 3-8. Using Multiple Regions to Learn [...]

  • Página 42

    Chapter 3 Making Graysca le and Color Measurements © National Instruments Corporation 3-13 IMA Q Vision for Visual Bas ic User Manual Ignoring Learned Colors You can ignore cer tain color compo nents in color m atching by setting the corresponding component in the inpu t color spectrum array to –1. To set a particular color component, follow the[...]

  • Página 43

    © National Instruments Cor poration 4-1 IMAQ Vision for Visual Bas ic User Manual 4 Performing Particle Analysis This chapter describes how to perform particle analysis on the images. Use particle analysis to find statistical in formation about particles, such as the presence, size, number, and location of particle regions. With this information, [...]

  • Página 44

    Chapter 4 Per forming Particle Analysis IMAQ Vision for Visual Basic User Manual 4-2 ni.com If all the objects in the grayscale image are either brighter or darker than the background, you can use CWIMAQVision.AutoThreshold to automatically determ ine the opti mal threshold rang e and thresh old the image. Automatic thresholdi ng techniques offer m[...]

  • Página 45

    Chapter 4 Per forming Particle Analysis © National Instruments Cor poration 4-3 IMAQ Vision for Visual Bas ic User Manual Removing Unwanted Particles Use CWIMAQVision.RejectBorder to remove particles that touch the border of the image. Reject particles on the border of the image when you suspect that the information abou t those particles is incom[...]

  • Página 46

    Chapter 4 Per forming Particle Analysis IMAQ Vision for Visual Basic User Manual 4-4 ni.com Improving Particle Shapes Use CWIMAQVision.FillHole to fill holes in the particles. Use CWIMAQVision.Morphology to perform a variety of operations on the particles. You can use the Open, Close, Proper Open, Proper Close, and auto-median operation s to smooth[...]

  • Página 47

    Chapter 4 Per forming Particle Analysis © National Instruments Cor poration 4-5 IMAQ Vision for Visual Bas ic User Manual cwimaqMeasurementA verageHorizSe gmentLength A v erage length of a horizontal segment in the particle. cwimaqMeasurementA vera geV ertSe gmentLe ngth A v erage length of a vertical segment in the particle. cwimaqMeasurementBoun[...]

  • Página 48

    Chapter 4 Per forming Particle Analysis IMAQ Vision for Visual Basic User Manual 4-6 ni.com cwimaqMeasurementCon v exHullPerimeter P erimeter of the small est con v e x polygon containing all points i n the particle. cwimaqMeasurementElongationF actor Max Feret Diameter divided b y Equi v alent Rect Short Side (Feret). cwimaqMeasurementEquiv alentE[...]

  • Página 49

    Chapter 4 Per forming Particle Analysis © National Instruments Cor poration 4-7 IMAQ Vision for Visual Bas ic User Manual cwimaqMeasurementHolesArea Sum of the areas of each hole in the particle. cwimaqMeasurementHolesPerimeter Sum of the perimeters of each hole in the particle. cwimaqMeasurementHuMoment1 The f irst Hu moment. cwimaqMeasurementHuM[...]

  • Página 50

    Chapter 4 Per forming Particle Analysis IMAQ Vision for Visual Basic User Manual 4-8 ni.com cwimaqMeasurementMaxFeretDiameterStartY Y -coordinate of the start of the line segment connecting the two perimeter points that are the furthest apart. cwimaqMeasurementMaxHo rizSegmentLengthLeft X-coordinate of the leftmost pixel in the longest row of conti[...]

  • Página 51

    Chapter 4 Per forming Particle Analysis © National Instruments Cor poration 4-9 IMAQ Vision for Visual Bas ic User Manual cwimaqMeasurementNor mMomentOfInertiaXY The normalized moment of inertia in the X and Y directions. cwimaqMeasurementNor mMomentOfInertiaXY Y The normalized moment of inertia in the X direction once and the Y direction twice. c[...]

  • Página 52

    Chapter 4 Per forming Particle Analysis IMAQ Vision for Visual Basic User Manual 4-10 ni.com cwimaqMeasurementSumXXY The sum of all X-coordinates squared times Y -coordinat es in the p article. cwimaqMeasurementSumXY The sum of all X-coordinates times Y -coordinates in the particle. cwimaqMeasurementSumXYY The sum of all X-coordinates times Y -coor[...]

  • Página 53

    © National Instruments Cor poration 5-1 IMAQ Vision for Visual Bas ic 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 Visual Basic User Manual 5-2 ni.com 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 typical machine vision applicati on, you extract measurements from regions of interest rather than th e enti[...]

  • Página 55

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-3 IMAQ Vision for Visual Bas ic User Manual to as the measurement coordinate system. The measurement methods automatically move the R OIs to the corr ect position using the positio n of the measurement coordinate system with respect to the reference coordinate system[...]

  • Página 56

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-4 ni.com Figure 5-2. Coordinate Systems of a Refere nce Image and Inspection Image b . If you use CWMachineVision.FindCoordTransformUs ingTwoRects , specify two rectangular R OIs, each containing one s eparate, straight boundary of the object, as sh own in Figur[...]

  • Página 57

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-5 IMAQ Vision for Visual Bas ic User Manual Figure 5-3. Locating Coordinate System Ax es with T wo Search Areas 2. Choose the parameters you need to locate the edges on the object. 3. Choose the coordinate system axis direction. 4. Choose the results th at you want t[...]

  • Página 58

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-6 ni.com 1. Def ine a templa te that represen ts th e part of the object that you want to use as a reference feature. For more informatio n about defining a template, refer to th e Find Meas urement Poi nts section. 2. Define a re ctangular search area in which [...]

  • Página 59

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-7 IMAQ Vision for Visual Bas ic User Manual Choosing a Method to Build the Coordinate T ransformation Figure 5-4 guides you thro ugh choosing the best method fo r building a coordinate transfor mation for the application . Figure 5-4. Building a Coordinate T ransform[...]

  • Página 60

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-8 ni.com Set Search Areas Select ROIs in the imag es to limit the areas in which you perform the processing and inspection. You can define ROIs inte ractively or programmatically. Defining Regions Interactively Follow these steps to interactively define an ROI: [...]

  • Página 61

    Chapter 5 Per forming Machine Vision T asks © National Instruments Cor poration 5-9 IMAQ Vision for Visual Bas ic User Manual Defining Regions Programmatically When you have an automated application , you need to define regions of interest programmatically. You can pr ogrammatical ly define regions by providing basic parameters that describe the r[...]

  • Página 62

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User 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, us e CWMachineVision.FindStraightEdge and CWMachineVision.FindConcentricEdge . CWMachineVision.FindStraightEdge fi nds edges based on r[...]

  • Página 63

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-11 IMA Q Vision for Visual Bas ic User Manual Figure 5-6. Finding a Cir cular Feature These methods locate the intersection points between a set of search lines in the search region and the edge of an obj ect. Specify the separation between the lines that the method s[...]

  • Página 64

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-12 ni.com Finding Edge Points Along Multiple Search Contours Use the CWIMAQVision.Rake , CWIMAQVision.Spoke , and CWIMAQVision.ConcentricRake methods to find edge points along multiple search contour s. These methods behave like CWIMAQVision.FindEdges2 , but the[...]

  • Página 65

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-13 IMA Q Vision for Visual Bas ic User Manual 3. Define an image or an area of an image as the search area. A small search area reduces the tim e to find the features. 4. Set the t olerances and p arameters to specify h ow t he algorithm operates at run time using CWI[...]

  • Página 66

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-14 ni.com Feature Detail A template with relatively coarse features is less sensiti ve to variations in size and rotation than a model with fi ne features. However, the model must contain enough detail to identify it . Figure 5-8. Fe ature Detail Positional Info[...]

  • Página 67

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-15 IMA Q Vision for Visual Bas ic User Manual Background Information Unique background information in a template improves search performance and accuracy. Figure 5-10. Background In formation T raining the Pattern Matching Algorithm After you create a good template im[...]

  • Página 68

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-16 ni.com Defining a Search Area Two equally important factors define the success of a pattern matching algorithm: accuracy and speed. You can define a search area to reduce ambiguity in the search process. For example, if the image has multiple instances of a p[...]

  • Página 69

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-17 IMA Q Vision for Visual Bas ic 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 used [...]

  • Página 70

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-18 ni.com Minimum Contrast Contrast is the difference between the sm allest and lar gest pixel values in a region. You can set the minimum contra st to potentially increase the speed of the pattern matching algorithm. The pattern matchin g algorithm ignores all [...]

  • Página 71

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-19 IMA Q Vision for Visual Bas ic User Manual Using a Ranking Method to V erify Results The manner in which you interpret the pattern matchin g results depends on the application. For ty pical alignment applicat i ons, such as finding a fiducial on a wafer, the most i[...]

  • Página 72

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-20 ni.com 5. Set the t olerances and p arameters to specify h ow th e algorithm operates at run time using CWIMAQMatchColorPatternOptions . 6. T est the search algorith m on test images using CWIMAQVision.MatchColorPattern . 7. V erify the results using a rankin[...]

  • Página 73

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-21 IMA Q Vision for Visual Bas ic 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” requ[...]

  • Página 74

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User 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 the image has multiple instanc[...]

  • Página 75

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-23 IMA Q Vision for Visual Bas ic 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 the [...]

  • Página 76

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-24 ni.com Use one of the following four search strate gies: • V ery aggressiv e—Uses the lar gest step size, the most sub-sampling and only the dominant color from the template to search for the template. Use this strategy when the color in the template is a[...]

  • Página 77

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-25 IMA Q Vision for Visual Bas ic User Manual Minimum Contrast Use the minimum contrast to increas e the speed of the color pattern matching algorith m. The color pattern matching algorithm ignores all image regions where grayscale contrast values fall beneath a set m[...]

  • Página 78

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-26 ni.com • Does not always require the lo cation with sub-pix el accuracy • Does not require shape information for the region Complete the f ollo wing step s to f ind features in an ima ge using color location: 1. Define a reference pa ttern in the form of [...]

  • Página 79

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-27 IMA Q Vision for Visual Bas ic User Manual the rake method, and then they compute the distance between the points detected on the edges along each search line of the rak e and return the largest or smallest distance in either the horizontal or v ertical direction. [...]

  • Página 80

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-28 ni.com • FindMidLine —Finds the line that is midway between a point and a line and is parallel to the line. • FindPolygonArea —Calculates the area of a polygon specif ied by its vertex points. Instrument Reader Measurements You can make measurements b[...]

  • Página 81

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-29 IMA Q Vision for Visual Bas ic User Manual Before you classify objects, you must create a classifier f ile with samples of the objects using the NI Clas si fication T raining Interface. Go to Start » Programs»National Instrument s»Cla ssification Training to lau[...]

  • Página 82

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-30 ni.com types: Codabar , Code 39, Code 93, Code 128, EAN 8, EAN 13, Interleaved 2 of 5, MSI, and UPCA. Read Data Matrix Barcode Use CWIMAQVision.ReadDataMat rixBarcode to read v alues encoded in a Data Matrix barcode. This method can automatically det ermine t[...]

  • Página 83

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-31 IMA Q Vision for Visual Bas ic User Manual By default, CWIMAQVision.ReadDataMatrixBar code automatically detects the type of barcode to read. Y ou can improv e the performance of the function by specifying the type of b arcode in the application. IMA Q V ision supp[...]

  • Página 84

    Chapter 5 Per forming Mac hine Vision T asks IMAQ Vision for Visual Basic User Manual 5-32 ni.com • DrawRectangle —Ov erlays a CWIMA QRectangle object on an image. • DrawOval —Overlays a CWIMA QOval object on an image. • DrawArc —Overlays a CWIMA QArc object on an image. • DrawPicture —Overlays a picture ob ject onto the image. • [...]

  • Página 85

    Chapter 5 Per forming Machine Vision T asks © National Instruments Corporation 5-33 IMA Q Vision for Visual Bas ic User Manual to True . W ith CWMachineVision.FindPattern , you can ov erlay the search area and the result. Use CWIMAQOverlay.Clear to clear an y pre vious ov erlay information from the image. Use CWIMAQVision.WriteImageAndVisionIn fo [...]

  • Página 86

    © National Instruments Cor poration 6-1 IMAQ Vision for Visual Bas ic User Manual 6 Calibrating Images This chapter describes how to ca librate the imaging system, save calibration information , and attach calibration in formation to an image. After you set up the imaging system, you may want to calibrat e the system. If the imaging setup is su ch[...]

  • Página 87

    Chapter 6 Calibrating Images IMAQ Vision for Visual Basic 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 su pplying an image of a grid or providing a list [...]

  • Página 88

    Chapter 6 Calibr ating Images © National Instruments Cor poration 6-3 IMAQ Vision for Visual Bas ic User Manual Defining a Reference Coordinate System To express measurements in real-world units, you must define a coordinate system in the imag e of the grid. Use CWIMAQLearnCalibrationOptions.Calibr ationAxisInfo to define a coordinate system by it[...]

  • Página 89

    Chapter 6 Calibrating Images IMAQ Vision for Visual Basic 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 list with the lo west[...]

  • Página 90

    Chapter 6 Calibr ating Images © National Instruments Cor poration 6-5 IMAQ Vision for Visual Bas ic 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 Visual Basic User Manual 6-6 ni.com Specifying Scaling Factors Scaling factors are the real-wor ld distances between the dots in the calibration grid in the x and y directi ons and the units in which the distances are measured. Use CWIMAQCalibrationGridOptions.GridDes criptor to specify the scaling facto[...]

  • Página 92

    Chapter 6 Calibr ating Images © National Instruments Cor poration 6-7 IMAQ Vision for Visual Bas ic User Manual Choose the perspecti ve projection al gorithm when the system exhibits perspectiv e errors only . A persp ectiv e projection calibration has an accurate transformation e v en in areas not co vered b y the calibration grid, as shown in Fi[...]

  • Página 93

    Chapter 6 Calibrating Images IMAQ Vision for Visual Basic User Manual 6-8 ni.com Note A high score does not reflect the accurac y of the system. If the learning process returns a learni ng score below 600, try the follo wing: 1. Make sure the grid complies with the guidelines listed in the Defining a Calibration Tem plate section. 2. Check the ligh[...]

  • Página 94

    Chapter 6 Calibr ating Images © National Instruments Cor poration 6-9 IMAQ Vision for Visual Bas ic User Manual Calibration Invalidation Any image processing operation th at ch anges the image si ze or orientation voids the calibration information in a calibrated image. Examples of methods that void calibration in formation include CWIMAQVision.Re[...]

  • Página 95

    Chapter 6 Calibrating Images IMAQ Vision for Visual Basic User Manual 6-10 ni.com Figure 6-7. Defini ng a Simp le Calibration Save Calibration Information After you learn th e calibration informatio n, you can save i t so that yo u do not have to relearn the informatio n for subsequent processing. Use CWIMAQVision.WriteImageAndVisionInfo to save th[...]

  • Página 96

    Chapter 6 Calibr ating Images © National Instruments Corporation 6-11 IMA Q Vision for Visual Bas ic User Manual CWIMAQVision.ConvertPixelToRealWorld Coordinates . If the application requires shape measurements, correct the image by removing distortion with CWIMAQVision.CorrectCalibratedImage . Note Correcting images is a time-intensive operation.[...]

  • Página 97

    © National Instruments Corporation A-1 IMAQ Vision for Visual Basic 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 98

    © National Instruments Corporation G-1 IMAQ Vision for Visual Basic 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 by [...]

  • Página 99

    Glossary IMAQ Vision for Visual Basic 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 Fun[...]

  • Página 100

    Glossary © National Instruments Corporation G-3 IMAQ Vision for Visual Basic User Manual C caliper (1) A function in the NI V ision Assistant and in NI V ision Buil der for Automated Inspec tion that calcu lates di stances, angles, circular f its, and the center of mass based on posi tions giv en by edge detection, particle analysis, centroid, and[...]

  • Página 101

    Glossary IMAQ Vision for Visual Basic User Manual G -4 ni.com connectivity-4 Only pixels adjacent in the hori zontal and vertical dir ections are considered neighbors. connecti vity-8 All 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 color deco[...]

  • Página 102

    Glossary © National Instruments Corporation G-5 IMAQ Vision for Visual Basic User Manual edge steepness The number of pixels that co rresponds to the slope or transition area of an edge. energy center The center of mass of a grayscale image. See center of mass . equalize function See histo gram equalization . erosion Reduces the size of an object [...]

  • Página 103

    Glossary IMAQ Vision for Visual Basic User Manual G -6 ni.com gradient filter An edge detection al gorithm that extracts the contours in gray-le vel v alues. Gradient filters include the Pr ewitt 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 surrou[...]

  • Página 104

    Glossary © National Instruments Corporation G-7 IMAQ Vision for Visual Basic User Manual hit-miss function Locates objects in the image similar to the patte rn defi ned in the structuring element. HSI A color encoding scheme in hue, saturation, and intensity . HSL A color encoding scheme using hue, saturation, and luminance informat ion where each[...]

  • Página 105

    Glossary IMAQ Vision for Visual Basic 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 ho[...]

  • Página 106

    Glossary © National Instruments Corporation G-9 IMAQ Vision for Visual Basic User Manual intensity calibr ation Assigns user-def ined 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 ra[...]

  • Página 107

    Glossary IMAQ Vision for Visual Basic User Manual G-10 ni.com linear filter A special algorith m that calculates the v alue of a pixel based on its o wn pixel v alue as well as the pixel values of its neighbors. The sum of this calculation is d ivided b y the sum of th e elements in the matrix to obtain a new pixel v alue. logarithmic functio n Inc[...]

  • Página 108

    Glossary © National Instruments Corporation G-11 IMA Q Vision for Visual Basic User Manual M M (1) Mega, the standard metric prefix for 1 mil lion or 10 6 , when used w ith units of measure such as v olts and hertz. (2) Mega, the pref ix for 1,048,576, or 220, when used with B to quantify data or computer memo ry . machine vision An automated a pp[...]

  • Página 109

    Glossary IMAQ Vision for Visual Basic User Manual G-12 ni.com NI-IMA Q The dri ver software for National Instruments IMA Q hardware. nonlinear f ilter Replaces each pix el v alue with a nonlinear function of its surrounding pixels. nonlinear gradient filter A highpass edge-extraction filter that f av ors vertical edges. nonlinear Prewitt filter A h[...]

  • Página 110

    Glossary © National Instruments Corporation G-13 IMA Q Vision for Visual Basic User Manual optical representation Contains the low-frequenc y information at the center and the high- frequency information at the corners of an FFT -transformed image. outer gradient Finds the outer boundary of objects. P palette The gradation of colors used to displa[...]

  • Página 111

    Glossary IMAQ Vision for Visual Basic User Manual G-14 ni.com proper-closing A finite combination of successi ve closing and opening operations that you can use to fill small holes and smooth the boundaries of objects. proper-opening A finite combination of successi ve opening and closing operations that you can use to remov e small particles and s[...]

  • Página 112

    Glossary © National Instruments Corporation G-15 IMA Q Vision for Visual Basic User Manual 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 col[...]

  • Página 113

    Glossary IMAQ Vision for Visual Basic 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 th[...]

  • Página 114

    Glossary © National Instruments Corporation G-17 IMA Q Vision for Visual Basic User Manual 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.[...]

  • Página 115

    © National Instruments Cor poration I-1 IMAQ Vision for Vis ual Basic User Manual Index Numerics 1D barcodes, 5-29 reading, 5-29 A acquiring images, 2-4 continuous acquisition , 2-5 one-shot acquisition, 2-4 Acquisition Type combo box, 2-4 ActiveX objects, 1-5 adding shapes to ROIs, 3-5 analyzing images, 2-7, 2-8 Annulus tool, 3 -2 Application, 1-[...]

  • Página 116

    Index IMAQ Vision for Visual Basic User Manual I-2 ni.com color pattern matching finding points, 5-19 optimize speed w ith s earch strategy, 5-23 setting rotation angle ranges, 5- 25 color pattern matching algo rithms training, 5- 21 using contrast, 5-25 color scores, 5-24 color sensitivity, using to cont rol granularity in templa te images, 5- 23 [...]

  • Página 117

    Index © National Instruments Cor poration I-3 IMAQ Vision for Vis ual Basic User Manual documentation conventions used in manual, ix NI resources, A-1 related documentation, x drivers NI resources, A-1 NI-IMAQ, xi E edge detection, 5-3 finding f eatures, 5-9 edge points, finding along multipl e search contours, 5-12 error map, learning, 6-8 evalua[...]

  • Página 118

    Index IMAQ Vision for Visual Basic User Manual I-4 ni.com imaging systems, sett ing up, 2- 1 IMAQ Vision applications, creating, 1-5 improving binary images, 4-2 images, 2-9 particle shapes, 4-4 increasing speed of the color p attern matching algorithm, 5-25 speed of the patter n matching algorithm, 5-18 instrument, A-1 instrument drivers, xi instr[...]

  • Página 119

    Index © National Instruments Cor poration I-5 IMAQ Vision for Vis ual Basic User Manual O objects classifying, 5-29 detecting, 5-2 locating, 5-2 OCR, 5-29 one-shot acquisition, 2-4 optimizing speed of t he color pattern m atching algorithm, 5-23 Oval tool, 3-2 P Pan tool, 3-3 particle analysis, 4-1 performing, 4-1 particle measurements, 4-4 partic[...]

  • Página 120

    Index IMAQ Vision for Visual Basic User Manual I-6 ni.com ROIs adding shapes, 3-5 programmatically defining, 3-5 Rotated Rectangle tool, 3-2 rotation angle ranges setting for color pattern matc hing, 5-25 setting for pattern matchin g, 5-18 rotationally symm etric template, 5-20 S saving calibration inform ation, 6-10 scaling factors, specifying, 6[...]

  • Página 121

    Index © National Instruments Cor poration I-7 IMAQ Vision for Vis ual Basic User Manual testing search algorithms, 5-18, 5-25 tolerances, setting for pattern matching, 5-17 touching particles, separating , 4-3 training characters, 5-29 color pattern matching algo rithms, 5-21 pattern matching algorit hm, 5-15 training and certificatio n (NI resour[...]