Using Vision Assistant for VI Generation

Author: Bob Sherbert

Keywords: LabVIEW, Vision Assistant, VI Export


This image shows successive steps from an image processing script created in NI's Vision Assistant. Image analysis and manipulation libraries are, in general, difficult and time consuming to learn and work with. As with many tasks, the addition of a graphical front end can aid those who wish to use the software without investing the time to develop complete mastery over it. Even with such a tool, it is still useful to have a quick guide or reference sheet on the topic. This document hopes to serve that purpose.

Motivation and Audience

National Instruments Vision Development Module provides a robust set of image processing algorithms for use with (and independent of) their LabVIEW software. By nature of what the module does, the algorithms included in it are all are fairly complicated, most requiring large configuration data structures as inputs along with very specific types of image data. Selection and configuration of these algorithms is made more difficult simply by their abundance. To help overcome this, NI has developed a program titled the 'Vision Assistant', which acts as a front-end to the bulk of the Vision VIs through a GUI interface and a simple scripting language. The program also has the ability to export its 'Vision Scripts' to LabVIEW VIs for usage with other user-written programs.

While working with the Vision VIs in LabVIEW without aid may be too complex an operation to be worthwhile, the task is greatly simplified by the Vision Assistant. This document will outline the software's features as well as describe the process of exporting a script to a VI.

This tutorial assumes that the reader has the following skills/experience:

Parts List and Sources

TABLE 1: Parts required for construction
PART DESCRIPTION VENDOR PART PRICE (2007) QTY Evaluation Available?
LabVIEW 8 NI 776671-09 $600 1 Y
NI Vision Development Module NI 777859R-09 $824 1 Y (critical functions disabled)
NI Vision Acquisition Software NI 778413-01 $100 1 Y

Program Overview

Processing Function Categories

The Processing functions are divided based on the types of images they are designed to work with. These groups are represented on the toolbar pictured here and are described below in order from left to right. This document describes each group as a whole briefly, and then highlights some of the important functions from the group.


Image

Image functions are a generic class for dealing with all image types. They include such functions as Histogram, Brightness Adjustment, Masks, Storage and Retrieval, and Overlay. They are used mostly for script setup and management.

Color

Color functions are used for dealing with RGB(Red, Green, Blue) and HSL(Hue, Saturation, Luminance) images. Please note that color functions cannot be used with non-color images. The color functions include (among others):

Grayscale

Binary

Machine Vision

Identification

The Identification functions are mostly a collection of VIs used for identifying different types and varieties of bar codes.

Assembling a Script

The process of assembling a script is a very straightforward process. One simply needs to select the desired functions from the lower left hand menu and drag them into the Script window on the bottom of the screen. Most have options which can be configured by the user at the time they are selected. The functions can be arranged in the script windows in a linear fashion only. More information on the specifics of script assembly can be found in the tutorial Basic Pattern Recognition with NI Vision.

Exporting a Script

In Vision Assistant select Tools->Create LabVIEW VI. You will be prompted with a dialog box similar to this one:

Within the box select your LabVIEW version and the path to the file to be exported and press 'Finish'. A dialog displaying the words "Creating LabVIEW VI" will be displayed while processing takes place.

Adapting to LabVIEW



When the export has finished you will be presented with a full block diagram that corrosponds to the script you created in the Vision Assistant (pictured above). However, the script has been exported as a stand alone VI, it has no connection terminals for input or output. To make this VI accessable to other external VIs follow this procedure:

1. Create Control 2. Wire Control 3. Place Control
Right click on the input you wish to replace and select Create->Control from the menu. Delete the original input (file path in this case), and wire the new control into its former position. Switch to the front panel and position the new control as desired.
4. Wire Terminal
Switch the indicator icon on the front panel into 'connector mode' by performing a Right-Click->Show Connector. Pair the terminal of your choice and the new control by clicking first on the terminal and subsequently on the control. This will connect the control and terminal which may now be used by external VIs to pass data into yours.

Many of the configurable options you had access to in the Vision Assistant, such as searchable regions, patterns to match against, color/intensity thresholds, etc, are now hard-coded into data clusters which are passed into the image processing VIs. (In the case of this example, theses are the large pink boxes wired into the 'Geometric Matching' VI in the center of the diagram.) Part of the power of LabVIEW and the Vision Assistant is in their dynamic nature - we do not want to loose this configurability. You can reclaim the dynamic nature of these data structures and controls by following the above procedure for as many inputs as your VI requires.

Source Documents


LabVIEW and Vision Assistant
The source documents used in this tutorial are available in the archive
exponential.zip

Final Words

In this tutorial we covered the basic components and divisions of NI's Vision Assistant. We also overviewed the process for exporting a Vision Script to a LabVIEW VI and integrating it for usage into larger programs.

The author can be reached by email