background image

IMAQ

IMAQ Vision
for Measurement Studio

User Manual

LabWindows/CVI

IMAQ Vision for LabWindows/CVI User Manual

May 2001 Edition

Part Number 323022A-01

Содержание IMAQ Vision

Страница 1: ...IMAQ IMAQ Vision for Measurement Studio User Manual LabWindows CVI IMAQ Vision for LabWindows CVI User Manual May 2001 Edition Part Number 323022A 01...

Страница 2: ...Germany 089 741 31 30 Greece 30 1 42 96 427 Hong Kong 2645 3186 India 91805275406 Israel 03 6120092 Italy 02 413091 Japan 03 5472 2970 Korea 02 596 7456 Mexico D F 5 280 7625 Mexico Monterrey 8 357 7...

Страница 3: ...buse misuse or negligent acts and power failure or surges fire flood accident actions of third parties or other events outside reasonable control Copyright Under the copyright laws this publication ma...

Страница 4: ...software such as menu items and dialog box options Bold text also denotes parameter names italic Italic text denotes variables emphasis a cross reference or an introduction to a key concept This font...

Страница 5: ...System 2 2 Create an Image 2 2 Source and Destination Images 2 4 Acquire or Read an Image 2 5 Acquiring an Image 2 6 Reading a File 2 6 Converting an Array to an Image 2 7 Display an Image 2 7 Attach...

Страница 6: ...on to Build a Coordinate Transform 5 3 Using Pattern Matching to Build a Coordinate Transform 5 5 Choosing a Method to Build the Coordinate Transform 5 7 Set Search Areas 5 8 Interactively Defining Re...

Страница 7: ...27 Instrument Reader Measurements 5 27 Display Results 5 28 Chapter 6 Calibration Perspective and Nonlinear Distortion Calibration 6 1 Defining a Calibration Template 6 2 Defining a Reference Coordina...

Страница 8: ...sion and scientific imaging applications IMAQ Vision for Visual Basic is a collection of ActiveX controls that offer the same imaging functionality as IMAQ Vision for LabWindows CVI National Instrumen...

Страница 9: ...als technical presentations the Instrument Driver Network a measurement glossary an online magazine a product advisor and a community area where you can share ideas questions and source code with visi...

Страница 10: ...ns that create and manipulate regions of interest File I O Functions that read and write images to and from files Calibration Functions that learn calibration information and correct distorted images...

Страница 11: ...ad the meter Utilities Functions that return structures and a function that returns a pointer to predefined convolution matrices Obsolete Functions that are no longer necessary but may exist in older...

Страница 12: ...IMAQ Vision application For more information about items in either diagram see the corresponding chapter listed to the right of the item Note Diagram items enclosed with dashed lines are optional ste...

Страница 13: ...ements Measure Grayscale Statistics Measure Color Statistics 1 Correct Image Distortion Create a Binary Image Improve a Binary Image Make Particle Measurements Chapter 4 Blob Analysis Convert Pixel Co...

Страница 14: ...u need given your space constraints and the size of the object you need to inspect For more information see Chapter 3 System Setup and Calibration of the IMAQ Vision Concepts Manual a Make sure your c...

Страница 15: ...nsate for perspective and nonlinear errors inherent in your imaging system Perspective errors occur when your camera axis is not perpendicular to the object under inspection Nonlinear distortion may o...

Страница 16: ...inters The number of image pointers a function takes depends on the image processing function and the type of image you want to use Some IMAQ Vision functions act directly on the image and require onl...

Страница 17: ...ion image to hold the result if the destination is not the appropriate size The following examples illustrate source and destination images with imaqTranspose imaqTranspose myImage myImage This functi...

Страница 18: ...hat the processing or analysis is dependent on the contents of another image the image mask The only pixels in the source image that are processed are those whose corresponding pixels in the image mas...

Страница 19: ...return a copy of the current image Use imaqStopAcquisition to stop the acquisition Acquire a fixed number of images using a sequence acquisition Set up the acquisition using imaqSetupSequence Use ima...

Страница 20: ...indows Use the other display functions to configure the appearance of each external window Properties you can set include whether the window has scroll bars is resizable or has a title bar You can als...

Страница 21: ...image quality is high enough for your inspection task To obtain the values of parameters that you want to use in processing functions during the inspection process The histogram and line profile tool...

Страница 22: ...can determine if the image is noisy and identify the characteristics of the noise If the image quality meets your needs use the pixel distribution information to determine some parameters of the insp...

Страница 23: ...se either a lowpass or highpass filter depending on your needs Lowpass filters remove insignificant details by smoothing the image removing sharp details and smoothing the edges between the objects an...

Страница 24: ...ing seven transformations Erosion Reduces the brightness of pixels that are surrounded by neighbors with a lower intensity Dilation Increases the brightness of pixels surrounded by neighbors with a hi...

Страница 25: ...ove your image in the frequency domain with a lowpass or highpass frequency filter Specify which type of filter to use with imaqAttenuate or imaqTruncate Lowpass filters smooth noise details textures...

Страница 26: ...the spatial domain use imaqInverseFFT Complex Image Operations The imaqExtractComplexPlane and imaqReplaceComplexPlane functions allow you to access process and update independently the real and imag...

Страница 27: ...ent with a reference Figure 3 1 illustrates the basic steps involved in making grayscale and color measurements Figure 3 1 Steps to Taking Grayscale and Color Measurements Define Regions of Interest A...

Страница 28: ...e Action Click on one corner and drag to the opposite corner to create the rectangle Then click on the lines inside the rectangle and drag to adjust the rotation angle Oval Draw an oval or circle in t...

Страница 29: ...wn Ctrl while drawing additional ROIs You can display the IMAQ Vision tools palette as part of an ROI constructor window or in a separate floating window Follow these steps to invoke an ROI constructo...

Страница 30: ...ion you selected You can input the ROI descriptor into many analysis and processing functions You can also convert the ROI descriptor into an image mask which you can use to process selected regions i...

Страница 31: ...ce of the tools window Use imaqMoveToolWindow to move the tools palette Use imaqCloseToolWindow to close the tools palette If you want to draw an ROI without using an ROI constructor or displaying the...

Страница 32: ...ly To programmatically define an ROI create the ROI using imaqCreateROI and then add the individual contours A contour is a shape that defines an ROI You can create contours from points lines rectangl...

Страница 33: ...eviation minimum intensity and maximum intensity Use imaqLightMeterRect to get the pixel value statistics within a rectangular region in an image Use imaqQuantify to obtain the following statistics ab...

Страница 34: ...into an 8 bit image Comparing Colors You can use the color matching capability of IMAQ Vision to compare or evaluate the color content of an image or regions in an image Follow these steps to compare...

Страница 35: ...This function returns an array of scores that indicates how close the matches are to the learned color information 5 Use the color matching score as a measure of similarity between the reference colo...

Страница 36: ...esents the entire color distribution of the image In a fabric identification application for example an entire image can specify the color information associated with a certain fabric type as shown in...

Страница 37: ...r spectra for identical fuses If you learn the color spectrum by drawing a region of interest around the 3 amp fuse in the upper row and then do a color matching for the 3 amp fuse in the upper row yo...

Страница 38: ...lor information An image containing a few well separated colors in the color space requires a lower sensitivity to describe the color than an image that contains colors that are close to one another i...

Страница 39: ...the index to the color spectrum by locating the corresponding bins in the color wheel where each bin corresponds to a component in the color spectrum array Ignoring certain colors such as the backgrou...

Страница 40: ...s such as detecting flaws on silicon wafers or detecting soldering defects on electronic boards Examples of how blob analysis can help you perform web inspection tasks include locating structural defe...

Страница 41: ...interest in your grayscale image fall within a continuous range of intensities and you can specify this threshold range manually use imaqThreshold to threshold your image If all the objects in your gr...

Страница 42: ...that touch at one point use connectivity 4 to ensure that the software recognizes the pixels as two separate blobs For more information about connectivity see Chapter 9 Binary Morphology of the IMAQ...

Страница 43: ...th your application Improving Blob Shapes Use imaqFillHoles to fill holes in the blobs Use imaqMorphology to perform a variety of operations on the blobs You can use the IMAQ_AUTOM IMAQ_CLOSE IMAQ_PCL...

Страница 44: ...s within the particle IMAQ_AREA_OF_HOLES total area of the particle holes in pixels IMAQ_TOTAL_AREA area of the particle and its holes IMAQ_IMAGE_AREA area of the entire image in real world units IMAQ...

Страница 45: ...A_XY sum of the product of the x coordinate and y coordinate for each pixel of the particle IMAQ_PROJ_X sum of the vertical segments in a particle IMAQ_PROJ_Y sum of the horizontal segments in a parti...

Страница 46: ...the particle in user defined units IMAQ_RECT_LONG_SIDE length of the long side of a rectangle having the same area and perimeter as the particle in user defined units IMAQ_RECT_SHORT_SIDE length of t...

Страница 47: ...kes and spokes use edges represented in the image They locate with high accuracy the position of the edge of an object in the image For example you can use the edge location to measure the width of th...

Страница 48: ...images you need to process defining regions of interest is simple See the Set Search Areas section for information about selecting a region of interest Often the object under inspection appears rotat...

Страница 49: ...ome machine vision functions take this output and adjust the regions of inspection automatically You can also use these outputs to move the regions of inspection relative to the object programmaticall...

Страница 50: ...sformRects specify two rectangles each containing one separate straight boundary of the object as shown in Figure 5 3 The boundaries cannot be parallel The regions must be large enough to include the...

Страница 51: ...FERENCE To update the coordinate transform in subsequent images set this mode to IMAQ_UPDATE_TRANSFORM Using Pattern Matching to Build a Coordinate Transform You can build a coordinate transform using...

Страница 52: ...parameter to select your options for finding the pattern and the results that you want to overlay onto the image When setting the Mode element select IMAQ_MATCH_ROTATION_INVARIANT when you expect your...

Страница 53: ...has a straight distinct edge main axis The object contains a second distinct edge not parallel to the main axis in a separate search area The object contains a second distinct edge not parallel to th...

Страница 54: ...riptor of the region you selected You can input the ROI descriptor into many analysis and processing functions You can also use imaqSelectRect and imaqSelectAnnulus to define regions of interest Follo...

Страница 55: ...the coordinates of the start and end points See Chapter 3 Grayscale and Color Measurements for more information about defining regions of interest Find Measurement Points After you set regions of ins...

Страница 56: ...pter 5 Machine Vision IMAQ Vision for LabWindows CVI User Manual 5 10 ni com Figure 5 5 Finding a Straight Feature 1 Search Region 2 Search Lines 3 Detected Edge Points 4 Line Fit to Edge Points 2 1 4...

Страница 57: ...e functions use to detect edges The functions determine the intersection points based on their contrast width and steepness The software calculates a best fit line with outliers rejected or a best fit...

Страница 58: ...earch lines in the region by specifying the distance in pixels between each line Specify the search direction as left to right or right to left for a horizontally oriented rectangle Specify the search...

Страница 59: ...A small search area reduces the time to find the features 4 Set the tolerances and parameters to specify how the algorithm operates at run time using the options parameter of imaqMatchPattern 5 Test t...

Страница 60: ...odel with fine features However the model must contain enough detail to identify it Figure 5 8 Feature Detail Positional information A template with strong edges in both the x and y directions is easi...

Страница 61: ...ing Use the learningMode parameter of imaqLearnPattern to specify which type of learning mode to use The learning process is usually time intensive because the algorithm attempts to find the optimum f...

Страница 62: ...e same orientation The location of the PCB in various images can move and rotate within a known range of values as illustrated in Figure 5 11 Figure 5 11a shows the template used to locate the PCB in...

Страница 63: ...a region The pattern matching algorithm ignores all image regions where contrast values fall beneath a set minimum contrast value If the search image has high contrast but contains some low contrast r...

Страница 64: ...n applications such as optical character verification OCV the score of the best match is more useful The score of a match returned by the pattern matching algorithm is an indicator of the closeness be...

Страница 65: ...ern 6 Test the search algorithm on test images using imaqMatchColorPattern 7 Verify the results using a ranking method Defining and Creating Good Color Template Images The selection of a good template...

Страница 66: ...thm After you have created a good template image the color pattern matching algorithm learns the important features of the template Use imaqLearnColorPattern to learn the template The learning process...

Страница 67: ...uity in the search process For example if your image has multiple instances of a pattern and only one instance is required for the inspection task the presence of additional instances of the pattern c...

Страница 68: ...tern matching algorithm makes assumptions about the images and color pattern matching parameters used in machine vision applications These assumptions work for a high percentage of the applications In...

Страница 69: ...decrease For more information on color sensitivity see Chapter 14 Color Inspection of the IMAQ Vision Concepts Manual Search Strategy Use the strategy element to optimize the speed of the color patte...

Страница 70: ...Contrast element to increase the color pattern matching algorithm s speed The color pattern matching algorithm ignores all image regions where grayscale contrast values fall beneath a set minimum cont...

Страница 71: ...of the region Does not always require the location with sub pixel accuracy Does not require shape information for the region Follow these general steps to find features in an image using color locatio...

Страница 72: ...ute the distance between the points detected on the edges along each search line of the rake and return the largest or smallest distance The imaqSelectRect function generates a valid input search regi...

Страница 73: ...imaqGetMidLine Finds the line that is midway between a point and a line and is parallel to the line imaqGetPolygonArea Calculates the area of a polygon specified by its vertex points Instrument Reade...

Страница 74: ...fy the image The overlay appears every time you display the image in an external window Use the following functions to overlay search regions inspection results and other information such as text and...

Страница 75: ...h area input into the function The search lines used for edge detection The edges detected along the search lines The result of the function With imaqFindPattern you can overlay the search area and th...

Страница 76: ...on Calibration Perspective errors and lens aberrations cause images to appear distorted This distortion misplaces information in an image but it does not necessarily destroy the information in the ima...

Страница 77: ...should range from 18 to 32 pixels as shown in Figure 6 1 The minimum distance between the edges of the dots should be 6 pixels as shown in Figure 6 1 Figure 6 1 Defining a Calibration Grid Note You ca...

Страница 78: ...hown in Figure 6 2a or direct as shown in Figure 6 2b Figure 6 2 Axis Direction in the Image Plane If you do not specify a coordinate system the calibration process defines a default coordinate system...

Страница 79: ...define a coordinate system yourself carefully consider the needs of your application Remember the following Express the origin in pixels Always choose an origin location that lies within the calibrati...

Страница 80: ...2 Getting Measurement Ready Images The grid does not need to occupy the entire image You can choose a region within the image that contains the grid After you acquire an image of the grid learn the c...

Страница 81: ...calibration options selected Set the user defined ROI using the ROI parameter of either imaqLearnCalibrationGrid or imaqLearnCalibrationPoints Choosing a Learning Algorithm Select a method in which to...

Страница 82: ...h Set the mode element of the options parameter to IMAQ_NONLINEAR to choose the nonlinear calibration algorithm Figure 6 6 Calibration ROIs Using the Learning Score The learning process returns a scor...

Страница 83: ...r your application use a correction table The correction table is a lookup table stored in memory that contains the real world location information of all the pixels in the image The extra memory requ...

Страница 84: ...gn the calibration to an arbitrary image using imaqSetSimpleCalibration To perform a simple calibration set a coordinate reference angle center and axis direction and scaling factors on the defined ax...

Страница 85: ...libration information of the current setup to each image you acquire This function takes in a source image containing the calibration information and a destination image that you want to calibrate The...

Страница 86: ...ly access the latest example programs system configurators tutorials technical news as well as a community of developers ready to share their own techniques Customer Education National Instruments pro...

Страница 87: ...fice Web sites from the Worldwide Offices section of ni com Branch office Web sites provide up to date contact information support phone numbers e mail addresses and current events If you have searche...

Страница 88: ...mma correction about a color image The alpha channel is stored as the first byte in the four byte representation of an RGB pixel annulus A region of interest that resembles a ring or partial ring area...

Страница 89: ...f bits n used to encode the value of a pixel For a given n a pixel can take 2n different values For example if n equals 8 bits a pixel can take 256 different values ranging from 0 to 255 If n equals 1...

Страница 90: ...trated without changing the first moment of the object about any axis centroid 1 The average of the x coordinates and y coordinates of a binary image or a blob in the image The centroid of a blob may...

Страница 91: ...lex image Stores information obtained from the FFT of an image The complex numbers that compose the FFT plane are encoded in 64 bit floating point values 32bits for the real part and 32bits for the im...

Страница 92: ...ntensity information about an image or regions of an image Typical measurements include minimum maximum and mean intensity values as well as the standard deviation of the intensity values density func...

Страница 93: ...with high entropy contains more pixel value variation than an image with low entropy equalize function See histogram equalization erosion Reduces the size of an object along its boundary and eliminat...

Страница 94: ...nal s brightness level and the voltage level needed to produce that brightness gauging Measurement of an object or distances between objects Gaussian filter A filter similar to the smoothing filter bu...

Страница 95: ...gray level value histogram equalization Transforms the gray level values of the pixels of an image to occupy the entire range 0 to 255 in an 8 bit image of the histogram increasing the contrast of the...

Страница 96: ...ocess of improving the quality of an image that you acquire from a sensor in terms of signal to noise ratio image contrast edge definition and so on image file A file containing pixel data and additio...

Страница 97: ...sity 1 The sum of the Red Green and Blue primary colors divided by three Red Green Blue 3 in a color image 2 The gray level value of a pixel in a grayscale image intensity calibration Assigning user d...

Страница 98: ...s of objects in the image by highlighting the variation of light intensity surrounding a pixel line gauge Measures the distance between selected edges with high precision subpixel accuracy along a lin...

Страница 99: ...ing edges lowpass frequency filter Attenuates high frequencies present in the frequency domain of the image A lowpass frequency filter suppresses information related to fast variations of light intens...

Страница 100: ...itative inspection analysis MSB Most significant bit M skeleton function Uses an M shaped structuring element in the skeleton function N neighbor A pixel whose value affects the value of a nearby pixe...

Страница 101: ...t The coordinate position in an image where you want to place the origin of another image Setting an offset is useful when performing mask operations opening An erosion followed by a dilation An openi...

Страница 102: ...red by the pixel An acquired pixel should optimally be square thus the optimal value is 1 0 but typically it falls between 0 95 and 1 05 depending on camera quality pixel calibration Directly calibrat...

Страница 103: ...and n columns has a resolution of m n reverse function Inverts the pixel values in an image RGB Color encoding scheme using red green and blue RGB color information where each pixel in the color imag...

Страница 104: ...ied by a shape template The matching process is invariant to rotation and can be set to be invariant to the scale of the objects shift invariant matching A pattern matching technique in which the refe...

Страница 105: ...matching functions A template can be a region selected from an image or it can be an entire image thickening Alters the shape of objects by adding parts to the object that match the pattern specified...

Страница 106: ...lue values of that pixel W watershed A technique used to segment an image into multiple regions web inspection The process of detecting defects in a continuous sheet of materials at production speeds...

Страница 107: ...ing blobs 4 4 particle measurements 4 4 to 4 7 steps figure 4 1 Broken Line tool table 3 2 C calibration 6 1 to 6 10 attaching calibration information to images 2 8 6 10 defining reference coordinate...

Страница 108: ...used in manual iv converting array to image 2 7 convolution filters 2 10 coordinate reference for calibration defining 6 2 to 6 5 coordinate transform building choosing method figure 5 7 edge detectio...

Страница 109: ...e 6 6 H highpass filters 2 10 highpass frequency filters attenuation 2 12 truncation 2 12 I ignoring learned colors 3 13 images See also blob analysis acquiring or reading 2 5 to 2 7 analyzing 2 8 to...

Страница 110: ...10 IMAQ_ERODE method 4 3 imaqExtractColorPlanes function 3 7 3 8 imaqExtractComplextPlane function 2 13 imaqExtractFromRing function 2 6 imaqFFT function 2 12 imaqFillHoles function 4 4 imaqFindCircul...

Страница 111: ...5 28 imaqOverlayText function 5 28 imaqParticleFilter function 4 4 IMAQ_PCLOSE method 4 4 IMAQ_POPEN method 4 3 4 4 imaqQuantify function 3 7 imaqRake function 5 12 imaqReadBarcode function 5 28 imaq...

Страница 112: ...locating objects to inspect See machine vision lookup table transformations 2 9 to 2 10 lowpass filters 2 10 lowpass frequency filters attenuation 2 12 truncation 2 12 M machine vision 5 1 to 5 29 co...

Страница 113: ...emplate images 5 13 to 5 15 defining search area 5 15 to 5 16 general steps 5 13 setting matching parameters and tolerances 5 16 to 5 17 testing search algorithm on test images 5 18 training the algor...

Страница 114: ...stics system integration by National Instruments A 1 T technical support resources A 1 to A 2 template for calibration defining 6 2 template images defining color pattern matching 5 19 to 5 20 pattern...

Отзывы: