IMAQ ™ IMAQ Vision ™ for Measurement Studio User Manual LabWindows/CVI IMAQ Vision for LabWindows/CVI User Manual May 2001 Edition Part Number 323022A-01...
Any action against National Instruments must be brought within one year after the cause of action accrues. National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control.
Page 4
Conventions The following conventions are used in this manual: » The » symbol leads you through nested menu items and dialog box options to a final action. The sequence File»Page Setup»Options directs you to pull down the File menu, select the Page Setup item, and select Options from the last dialog box.
Page 6
Contents Measure Color Statistics... 3-7 Comparing Colors ... 3-8 Learning Color Information ... 3-9 Choosing the Right Color Information ... 3-9 Specifying the Color Information to Learn ... 3-10 Choosing a Color Representation Sensitivity ... 3-12 Ignoring Learned Colors... 3-13 Chapter 4 Blob Analysis Correct Image Distortion...
For information about the system requirements and installation procedure for Note IMAQ Vision for LabWindows/CVI, see the IMAQ Vision for Measurement Studio Release Notes that came with your software. About IMAQ Vision...
Application Notes—If you want to know more about advanced IMAQ Vision concepts and applications, refer to the Application Notes located on the National Instruments Web site at ni.com/appnotes.nsf/ NI Developer Zone (NIDZ)—If you want even more information about developing your vision application, visit the NI Developer Zone at .
Chapter 1 Introduction to IMAQ Vision Table 1-1. IMAQ Vision Function Types (Continued) Function Type Frequency Functions for the extraction and manipulation of complex planes. Functions of Domain this type perform FFTs, inverse FFTs, truncation, attenuation, addition, Analysis subtraction, multiplication, and division of complex images. Barcode A function that reads a barcode.
Page 13
Chapter 1 Introduction to IMAQ Vision Chapter 3: Grayscale and Color Measurements Correct Image Distortion Create a Binary Image Chapter 4: Improve a Binary Image Blob Analysis Make Particle Measurements Convert Pixel Coordinates to Real-World Coordinates IMAQ Vision for LabWindows/CVI User Manual Define Regions of Interest Measure Measure...
Configure the driver software for your image acquisition device. If you have a National Instruments image acquisition device, configure your NI-IMAQ driver software through Measurement & Automation Explorer (MAX). Open MAX by double-clicking the Measurement & Automation Explorer icon on your desktop. For more information, see the NI-IMAQ User Manual and the MAX online help.
Chapter 2 Getting Measurement-Ready Images Source and Destination Images Some IMAQ Vision functions that modify the contents of an image have source image and destination image input parameters. The source image receives the image to process. The destination image receives the processing results.
Chapter 2 Getting Measurement-Ready Images Acquiring an Image Use one of the following methods to acquire images with a National Instruments image acquisition (IMAQ) device: • • • • • You must use the Note acquisition device. Reading a File computer into the image reference.
Chapter 2 Getting Measurement-Ready Images Attach Calibration Information If you want to attach the calibration information of the current setup to each image you acquire, use function takes in a source image containing the calibration information and a destination image that you want to calibrate. The output image is your inspection image with the calibration information attached to it.
Chapter 2 Getting Measurement-Ready Images • • • Filters Filter your image when you need to improve the sharpness of transitions in the image or increase the overall signal-to-noise ratio of the image. You can choose 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 and the background.
Page 25
Chapter 2 Getting Measurement-Ready Images An image can have extraneous noise, such as periodic stripes, introduced during the digitization process. In the frequency domain, the periodic pattern is reduced to a limited set of high spatial frequencies. Also, the imaging setup may produce non-uniform lighting of the field of view, which produces an image with a light drift superimposed on the information you want to analyze.
Page 28
Chapter 3 Grayscale and Color Measurements Icon Tool Name Selection Tool Point Line Rectangle Rotated Rectangle Oval Annulus Broken Line Polygon Freehand Line IMAQ Vision for LabWindows/CVI User Manual Table 3-1. Tools Palette Functions Function Select an ROI in the image and adjust the position of its control points and contours.
Page 30
Chapter 3 Grayscale and Color Measurements The tools palette, shown in Figure 3-3, automatically transforms from the palette on the left to the palette on the right when you manipulate an ROI tool in an image window. The palette on the right displays the characteristics of the ROI you are drawing.
Chapter 3 Grayscale and Color Measurements You can also use imaqSelectRect() interest. Follow these steps to use these functions: Programmatically Defining Regions When you have an automated application, you may need to define regions of interest programmatically. To programmatically define an ROI, create the ROI using A contour is a shape that defines an ROI.
Chapter 3 Grayscale and Color Measurements image. Using image from a set of three 8-bit images, where each image becomes one of the three primary components. Figure 3-4 illustrates how a color image breaks down into its three components. Green Blue Saturation Color...
Chapter 3 Grayscale and Color Measurements Specifying the Color Information to Learn You can learn the color information associated with an entire image, a region in an image, or multiple regions in an image. Using the Entire Image You can use an entire image to learn the color spectrum that represents the entire color distribution of the image.
Chapter 3 Grayscale and Color Measurements 1 Regions used to learn color information Choosing a Color Representation Sensitivity When you learn a color, you need to specify the sensitivity required to specify the color 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 in the color space.
Chapter 4 Blob Analysis Correct Image Distortion If you need to make accurate shape measurements based on the blobs in an image containing perspective and nonlinear distortion errors, correct the distortion using the calibration information you attached to your image. Use your grayscale image before thresholding it.
Chapter 4 Blob Analysis If you know enough about the shape features of the blobs you want to keep, you. If you do not have enough information about the particles you want to keep at this point in your processing, use the particle measurement functions to obtain this information before applying a particle filter.
Page 45
Chapter 4 Blob Analysis Table 4-1. Particle Measurements (Continued) Measurement IMAQ_MAX_SEGMENT_LEFT_COLUMN IMAQ_MAX_SEGMENT_TOP_ROW IMAQ_PERIMETER IMAQ_PERIMETER_OF_HOLES IMAQ_SIGMA_X IMAQ_SIGMA_Y IMAQ_SIGMA_XX IMAQ_SIGMA_YY IMAQ_SIGMA_XY IMAQ_PROJ_X IMAQ_PROJ_Y IMAQ_INERTIA_XX IMAQ_INERTIA_YY IMAQ_INERTIA_XY IMAQ_MEAN_H IMAQ_MEAN_V IMAQ_MAX_INTERCEPT IMAQ_MEAN_INTERCEPT IMAQ_ORIENTATION IMAQ_EQUIV_ELLIPSE_MINOR IMAQ Vision for LabWindows/CVI User Manual Description leftmost x-coordinate of longest horizontal line segment in a particle y-coordinate of longest horizontal line segment length of the outer contour of the particle in user-defined...
Chapter 5 Machine Vision Figure 5-1 illustrates the basic steps involved in performing machine vision. Diagram items enclosed with dashed lines are optional steps. Locate Objects to Inspect In a typical machine vision application, you extract measurements from regions of interest rather than the entire image. To use this technique, the parts of the object you are interested in must always appear inside the regions of interest you define.
Page 50
Chapter 5 Machine Vision 1 Search Area for the Coordinate System 2 Object Edges IMAQ Vision for LabWindows/CVI User Manual 3 Origin of the Coordinate System 4 Measurement Area Figure 5-2. Coordinate Systems of a Reference Image and Inspection Image If you use imaqFindTransformRects() rectangles, each containing one separate, straight boundary of the...
Page 52
Chapter 5 Machine Vision IMAQ Vision for LabWindows/CVI User Manual Define a template that represents the part of the object that you want to use as a reference feature. For more information about defining a template, see the Find Measurement Points Define a rectangular search area in which you expect to find the template.
Chapter 5 Machine Vision Set Search Areas Select regions of interest (ROIs) in your images to limit the areas in which you perform your processing and inspection. You can define ROIs interactively or programmatically. Interactively Defining Regions Follow these steps to interactively define an ROI: You can also use define regions of interest.
Chapter 5 Machine Vision These functions require you to input the coordinates of the points along the search contour. Use the edge of each contour in an ROI. If you have a straight line, use imaqGetPointsOnLine() using an ROI. These functions determine the edge points based on their contrast and slope.
Chapter 5 Machine Vision Feature detail A template with relatively coarse features is less sensitive to variations in size and rotation than a model with fine features. However, the model must contain enough detail to identify it. Positional information A template with strong edges in both the x and y directions is easier to locate.
Chapter 5 Machine Vision incorrect results. To avoid this, reduce the search area so that only the desired pattern lies within the search area. 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.
Chapter 5 Machine Vision Testing the Search Algorithm on Test Images To determine if your selected template or reference pattern is appropriate for your machine vision application, test the template on a few test images by using images generated by your machine vision application during true operating conditions.
Chapter 5 Machine Vision Feature Detail A template with relatively coarse features is less sensitive to variations in size and rotation than a model with fine features. However, the model must contain enough detail to identify it. Positional Information A template with strong edges in both the x and y directions is easier to locate.
Chapter 5 Machine Vision 1 Search Area for 20 Amp Fuses 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. Setting Matching Parameters and Tolerances Every color pattern matching algorithm makes assumptions about the images and color pattern matching parameters used in machine vision...
Chapter 5 Machine Vision Note Use the IMAQ_CONSERVATIVE close to each other in the image. Decide on the best strategy by experimenting with the different options. Color Score Weight When you search for a template using both color and shape information, the color and shape scores generated during the match process are combined to generate the final color pattern matching score.
Chapter 5 Machine Vision Convert Pixel Coordinates to Real-World Coordinates The measurement points you located with edge detection and pattern matching are in pixel coordinates. If you need to make measurements using real-world units, use the pixel coordinates into real-world units. Make Measurements You can make different types of measurements either directly from the image or from points that you detect in the image.
Chapter 5 Machine Vision each digit in an LCD or LED. To find the area of each digit, all the segments of the indicator must be activated. Use digits of an LCD or LED. specify a region of interest that encloses the barcode information, and specify the type of barcode.
Note You can use the calibration grid installed with IMAQ Vision at Start»Programs»National Instruments»Vision»Documentation»Calibration Grid. The dots have radii of 2 mm and center-to-center distances of 1 cm. Depending on your printer, these measurements may change by a fraction of a millimeter. You can purchase highly accurate calibration grids from optics suppliers, such as Edmund Industrial Optics.
Page 79
Chapter 6 Calibration 1 Origin of a Calibration Grid in the Real World Note If you specify a list of points instead of a grid for the calibration process, the software defines a default coordinate system, as follows: The origin is placed at the point in the list with the lowest x-coordinate value and then the lowest y-coordinate value.
Chapter 6 Calibration Specifying Scaling Factors Scaling factors are the real-world distances between the dots in the calibration grid in the x and y directions and the units in which the distances are measured. Use the factors. Choosing a Region of Interest Define a learning region of interest (ROI) during the learning process to define a region of the calibration grid you want to learn.
Chapter 6 Calibration Note A high score does not reflect the accuracy of your system. Learning the Error Map An error map helps you gauge the quality of your complete system. The error map returns an estimated error range to expect when a pixel coordinate is transformed into a real-world coordinate.
Chapter 6 Calibration Save Calibration Information After you learn the calibration information, you can save it so that you do not have to relearn the information for subsequent processing. Use imaqWriteVisionFile() calibration information to a file. To read the file containing the calibration information use attaching the calibration information you read from another image, see the Attach Calibration Information section.
Technical Support Resources Web Support National Instruments Web support is your first stop for help in solving installation, configuration, and application problems and questions. Online problem-solving and diagnostic resources include frequently asked questions, knowledge bases, product-specific troubleshooting wizards, manuals, drivers, software updates, and more. Web support is available...
Appendix A Technical Support Resources Worldwide Support National Instruments has offices located around the world to help address your support needs. You can access our branch office Web sites from the Worldwide Offices section of up-to-date contact information, support phone numbers, e-mail addresses, and current events.
Page 88
Numbers/Symbols One-dimensional. Two-dimensional. Three-dimensional. AIPD National Instruments proprietary image file format used for saving complex images and calibration information pertaining to step and spatial units (extension APD). alignment The process by which a machine vision application determines the location, orientation, and scale of a part being inspected.
Page 89
Glossary Bit. One binary digit, either 0 or 1. Byte. Eight related bits of data, an eight-bit binary number. Also denotes the amount of memory required to store one byte of data. barycenter The grayscale value representing the centroid of the range of an image's grayscale values in the image histogram.
Page 91
Glossary CLUT Color lookup table. Table for converting the value of a pixel in an image into a red, green, and blue (RGB) intensity. color images Images containing color information, usually encoded in the RGB form. color location The technique that locates a color template in a color image based on only the color information.
Page 93
Glossary edge Defined by a sharp change (transition) in the pixel intensities in an image or along an array of pixels. edge contrast The difference between the average pixel intensity before and the average pixel intensity after the edge. edge detection Any of several techniques to identify the edges of objects in an image.
Page 95
Glossary highpass attenuation Applies a linear attenuation to the frequencies in an image, with no attenuation at the highest frequency and full attenuation at the lowest frequency. highpass FFT filter Removes or attenuates low frequencies present in the FFT domain of an image.
Page 97
Glossary image visualization The presentation (display) of an image (image data) to the user. imaging Any process of acquiring and displaying images and analyzing image data. IMAQ Image Acquisition. inner gradient Finds the inner boundary of objects. inspection The process by which parts are tested for simple defects such as missing parts or cracks on part surfaces.
Page 99
Glossary logic operators The image operations AND, NAND, OR, XOR, NOR, XNOR, difference, mask, mean, max, and min. lossless compression Compression in which the decompressed image is identical to the original image. lossy compression Compression in which the decompressed image is visually similar but not identical to the original image.
Page 100
Operations on a point in an image that take into consideration the values of operations the pixels neighboring that point. NI-IMAQ Driver software for National Instruments IMAQ hardware. nonlinear filter Replaces each pixel value with a nonlinear function of its surrounding pixels.
Page 101
Glossary Nth order filter Filters an image using a nonlinear filter. This filter orders (or classifies) the pixel values surrounding the pixel being processed. The pixel being processed is set to the Nth pixel value, where N is the order of the filter. number of planes The number of arrays of pixels that compose the image.
Page 103
Glossary pyramidal matching A technique used to increase the speed of a pattern matching algorithm by matching subsampled versions of the image and the reference pattern. quantitative analysis Obtaining various measurements of objects in an image. real time A property of an event or system in which data is processed as it is acquired instead of being accumulated and processed at a later time.
Page 105
Glossary spatial resolution The number of pixels in an image, in terms of the number of rows and columns in the image. square function square root function standard representation Contains the low-frequency information at the corners and high-frequency information at the center of an FFT-transformed image. structuring element A binary mask used in most morphological operations.
Page 108
Index defining template images, 5-19 to 5-20 setting matching parameters and tolerances, 5-22 to 5-24 color score weight, 5-24 color sensitivity, 5-23 minimum contrast, 5-24 rotation angle ranges, 5-24 search strategy, 5-23 to 5-24 testing search algorithm on test images, 5-24 to 5-25 training pattern matching algorithm, 5-20 to 5-21...
Page 109
2-9 to 2-10 imaging system calibrating, 2-2 setting up, 2-1 to 2-2 IMAQ Machine Vision function tree, 1-4 IMAQ Vision for Measurement Studio application development environments, 1-2 creating applications, 1-5 to 1-6 general steps (figure), 1-5 inspection steps (figure), 1-6...
Need help?
Do you have a question about the IMAQ Vision for Measurement Studio and is the answer not in the manual?
Questions and answers