.NODE

Introduction to IMAQ Vision Builder

This section is not intended to replace the tutorial that comes with IMAQ Vision Builder [7] or even to represent an introduction to vision concepts [8]; the latter are part of this book's Chapters 4 and 5. Rather, the purpose of this section is to show you the power of this prototyping tool; again, it is not possible to solve more complicated problems or to obtain more functionality. Everything you can do with IMAQ Vision Builder, you can do with IMAQ Vision itself; the difference lies in the method by which you do it. Further information about IMAQ Vision Builder can be found in:

  • IMAQ Vision Builder Tutorial [7];
  • IMAQ Vision Concepts Manual [8];
  • IMAQ Vision Builder Release Notes [9].

These manuals are shipped with the IMAQ Vision Builder software.

IMAQ Vision Builder Environment

Figure 1.9 shows the typical IMAQ Vision Builder environment with a single image loaded. The environment mainly consists of the following parts :

Figure 1.9. IMAQ Vision Builder Environment. 1 Reference Window, 2 Script Window, 3 Image Size, 4 Zoom Ratio, 5 Processing Window [7]

graphics/01fig09.gif

  1. The Reference Window displays the original version of the image.
  2. All manipulations applied to the loaded image can be stored in the Script Window .
  3. The Image Size can be seen here, whereas
  4. this area indicates the actual Zoom Ratio .
  5. The Processing Window immediately shows all of your image manipulations.

A benefit of this program is that you cannot get lost in complex menu structures. All of the image processing and analysis happens in the environment of Figure 1.9. Only one different desktop may appear; the Image Browser (Figure 1.10) with the following main elements:

  1. The Image Browser itself shows the images in memory in either thumbnail or full-size view;
  2. Image Location gives the full path to the image file;
  3. the Browse Buttons are used for browsing the images in memory;
  4. the Thumbnail/Full-Size Toggle button, if pressed, displays the first image in full-size view or 16 images in thumbnail view, respectively;
  5. the Image Size is displayed in area 5 of Figure 1.10;
  6. Close Selected Image(s) does what it says;
  7. Image Type and
  8. File Format are the respective indicators.

Figure 1.10. IMAQ Vision Builder Image Browser. 1 Image Browser, 2 Image Location, 3 Browse Buttons, 4 Thumbnail/Full-Size Toggle, 5 Image Size, 6 Close Selected Image(s), 7 Image Type, 8 File Format [7]

graphics/01fig10.jpg

Be careful not to confuse the image browser view in full size with the processing mode view; they are quite similar. You need only select a menu item from the Image, Color , Grayscale, Binary, or Machine Vision submenus to change from browser to processing view.

Acquiring Images

IMAQ Vision Builder provides three possibilities for loading images into the image browser:

  • loading an image from a file;
  • acquiring an image from an image data source (e.g., a camera);
  • using the built-in simulation data.

The most interesting of these three is acquiring images directly from your hardware. Let us look at the example in Figure 1.11.

Figure 1.11. Acquiring Images into IMAQ Vision Builder. 1 Acquisition Window, 2 Acquisition Property Page, 3 Store Acquired Image in Browser Button, 4 IMAQ Image Acquisition Board and Channels [7]

graphics/01fig11.gif

Like National Instruments' Measurement and Automation Explorer (MAX), IMAQ Vision Builder shows your available hardware in a separate window (4 in Figure 1.11). Here, an IMAQ PCI-1408 with four video inputs (analog) can be seen together with a PCI-1424 (a 32-bit digital image acquisition board). After you select your desired image source, three types of image acquisition are offered :

  • Snap: acquires and displays a single image.
  • Grab: acquires and displays a continuous sequence (e.g., for camera focusing).
  • Sequence: similar to grab, with the difference that you can change specific settings. The images are sent to the image browser.

You can select one of the three acquiring options by pressing one of the selection buttons in the middle of the left area.

Depending on which image acquisition board you have installed in your computer, some properties of your acquisition hardware are displayed (2 in Figure 1.11). This example shows

  • the Number of Frames you want to acquire,
  • the Skip Count or the number of frames to skip between acquisitions,
  • the physical trigger Line ,
  • the triggering Action , and
  • the Timeout , within which the trigger must occur.

Vision Builder Functions

The image processing and analysis functions of IMAQ Vision Builder are identical to those provided by IMAQ Vision itself. Figure 1.12 shows an example, in which a line profile function is used for detecting object edges.

Figure 1.12. Edge Detection with a Line Profile. 1 Edges of Particles, 2 Fluctuation in Pixel Values, 3 Segment Drawn with Line Tool [7]

graphics/01fig12.gif

After you select Line Profile from the Image menu, the Vision Builder expects you to draw a line in the image. Therefore, it provides you with some simple drawing tools, similar to those of a drawing program like Microsoft Paint. The resulting profile along the line (3 in Figure 1.12) is shown in the bottom area (1 and 2 in Figure 1.12). You will notice three profiles for color images and one single profile for gray-scale images. The line profile function can be used for the (visual) detection of edges along the drawn line. We discuss other methods later.

Figure 1.13 shows another ”slightly more complex ”example. Here, Pattern Matching, Edge Detection, and Caliper tools collect measurement data from a metal bracket. Pattern Matching detects the holes in the left and the right area of the bracket , Caliper measures the distance between them, and Edge Detection finds the top and bottom edges.

Figure 1.13. Using the Caliper Tool [7]

graphics/01fig13.gif

Here is a list of the most important image analysis and processing functions provided by IMAQ Vision Builder 6.0 (structured by menu items):

  • Image

    • Histogram
    • Line Profile
    • Measure
    • 3D View
    • Brightness
    • Image Mask
    • Geometry
  • Color

    • Color Operators
    • Extract Color Planes
    • Color Threshold
    • Color Location
    • Color Pattern Matching
    • Color Matching
  • Grayscale

    • Lookup Table
    • Filters
    • Gray Morphology
    • FFT Filter
    • Operators
    • Conversion
    • Threshold
    • Quantify
    • Centroid
  • Binary

    • Basic Morphology
    • Advanced Morphology
    • Particle Filter
    • Invert Binary Image
    • Shape Matching
    • Particle Analysis
    • Circle Detection
  • Machine Vision

    • Edge Detector
    • Find Straight Edge
    • Find Circular Edge
    • Clamp
    • Pattern Matching
    • Caliper

Exercise 1.3: IMAQ Vision Builder.

Try the color-plane extraction example from Exercise 1.2. Load the same picture you used in that exercise into IMAQ Vision Builder (Take one with clearly visible areas of different colors and you will obtain interesting results; if you do not have one, take bear.bmp from the CD.). Select the Extract Color Planes option from the Color menu and compare the results with those from Exercise 1.2.

 

Creating Script Files

When you have set up your image analysis, image processing, or machine vision application with IMAQ Vision Builder, you will notice that the Vision Builder might not be the best choice for running your application automatically. Therefore, the Vision Builder provides some possibilities for creating running applications. One of them is the script file .

Figure 1.14 shows an example from the IMAQ Vision Builder tutorial [7]. Here, some processing functions are used to find out how many circular "blobs" of a certain size can be seen in the image. Here, we do not talk about the way these functions are working, only how the application can be created.

Figure 1.14. Creating a Script File for Blob Analysis [7]

graphics/01fig14.jpg

If the single functions are tested and stored in the script window (usually with the Apply button), the script window will show a number of sequential entries. If you step through these entries or choose Run Script from one of the upper buttons, you will always get the same processing result. Now you can save your script file for later use with the Vision Builder, but, as mentioned above, this is not the best solution. The other possibility is to create a builder file , a text file that provides you with enough information to create a LabVIEW VI.

The lines below show the builder file for the application, taken from the tutorial and from Figure 1.14. An experienced LabVIEW user (like you) can program the application easily with this information.


 
IMAQ Vision Builder 6.0 List of functions generated : Sunday, 16. September 2001 09:34 STEP #1 Filters : Convolution - Highlight Details IMAQ Vision VI IMAQ Convolute C Function imaqConvolve Visual Basic Methods CWIMAQVision.Convolute Parameters: Kernel [0] [0] Float (SGL) -1,000000 Kernel [0] [1] Float (SGL) -1,000000 Kernel [0] [2] Float (SGL) -1,000000 Kernel [1] [0] Float (SGL) -1,000000 Kernel [1] [1] Float (SGL) 10,000000 Kernel [1] [2] Float (SGL) -1,000000 Kernel [2] [0] Float (SGL) -1,000000 Kernel [2] [1] Float (SGL) -1,000000 Kernel [2] [2] Float (SGL) -1,000000 STEP #2 Threshold : Manual Threshold IMAQ Vision VI IMAQ Threshold C Function imaqThreshold Visual Basic Methods CWIMAQVision.Threshold Parameters: Range.Lower value Float (SGL) 130,000000 Range.Upper value Float (SGL) 255,000000 IMAQ Vision VI IMAQ Cast Image C Function imaqCast Visual Basic Methods CWIMAQVision.Cast Parameters: Image Type Long (I32) 0 Connections: Connect output "Image Dst Out" of "IMAQ Threshold" to input "Image Src" of "IMAQ Cast Image". Connect output "error out" of "IMAQ Threshold" to input "error in (no error)" of "IMAQ Cast Image". STEP #3 Adv. Morphology : Remove borders objects IMAQ Vision VI IMAQ RejectBorder C Function imaqRejectBorder Visual Basic Methods CWIMAQVision.RejectBorder Parameters: Connectivity 4/8 Boolean TRUE STEP #4 Adv. Morphology : Fill holes IMAQ Vision VI IMAQ FillHole C Function imaqFillHoles Visual Basic Methods CWIMAQVision.FillHole Parameters: Connectivity 4/8 Boolean TRUE STEP #5 Particle Filter IMAQ Vision VI IMAQ Particle Filter C Function imaqParticleFilter Visual Basic Methods CWIMAQVision.ParticleFilter Parameters: Connectivity 4/8 Boolean TRUE Mode Boolean FALSE Selection Values[0].Parameter Unsigned Long (U32) 45 Selection Values[0].Lower Value Float (SGL) 1,000000 Selection Values[0].Upper Value Float (SGL) 1,060000 Selection Values[0].Exclude Interval Boolean FALSE STEP #6 Particle Analysis IMAQ Vision VI IMAQ ComplexParticle C Function imaqGetParticleInfo Visual Basic Methods CWIMAQVision.Particle Parameters: Connectivity 4/8 Boolean TRUE Number of Particles Long (I32) 0 IMAQ Vision VI IMAQ ComplexMeasure C Function imaqCalcCoeff Visual Basic Methods CWIMAQVision.ParticleCoefficients Parameters: Parameters[0] Long (I32) 0 Parameters[1] Long (I32) 8 Parameters[2] Long (I32) 9 Parameters[3] Long (I32) 19 Parameters[4] Long (I32) 35 Parameters[5] Long (I32) 45 Coefficients(2D) Long (I32) 0 Connections: Connect output "Complex Reports" of "IMAQ ComplexParticle" to input "Complex Reports" of "IMAQ ComplexMeasure". Connect output "error out" of "IMAQ ComplexParticle" to input "error in (no error)" of "IMAQ ComplexMeasure". Comment: Display your image with a Binary palette.

Creating LabVIEW VIs

You may argue that this procedure is still a lot of work (and you are right). If you are a lucky owner of IMAQ Vision Builder 6.0, there is a much more convenient solution: the LabVIEW VI Creation Wizard (Figure 1.15).

All you have to do is to select Create LabVIEW VI from the Script menu and the first dialog box shown in Figure 1.15 appears. After choosing some settings (for example, if the VI should be created from the current script or another one), you choose whether you want certain values set as constants in your VI or as editable indicators. After you have done this, the VI will be created automatically.

Figure 1.15. LabVIEW VI Creation Wizard

graphics/01fig15.gif

Figure 1.16 shows the VI created from the tutorial script metal.scr . I rearranged the icons to fit the figure to the book page. Remarkably, this VI is ready to run and can be created with the help of IMAQ Vision Builder in the total time of about one hour !

Figure 1.16. metal.vi Created by the VI Creation Wizard

graphics/01fig16.jpg

Finally, I have not mentioned some other procedures IMAQ Vision Builder provides; for example, transferring numerical data (such as that obtained by the Line Profile function) into Microsoft Excel; but I think there should be some things you should find out for yourself. Have fun!

NI Vision Builder for Automated Inspection





Image Processing with LabVIEW and IMAQ Vision
Image Processing with LabVIEW and IMAQ Vision
ISBN: 0130474150
EAN: 2147483647
Year: 2005
Pages: 55
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net