Image Applications with Hypersignal RIDE
Overview
This application note describes four applications using a standard video frame grabber – a color detector (red), a motion detector, an object tracker, and an object counter. These applications can be built using a standard low-cost color CCD camera (webcam) connected to the PC (typically through parallel port, USB, or an internal video camera interface card [ISA, PCI, etc.]).
Table of Contents
Example 1: A Color Detector (red color detector)
The first example, red_dtct.lst, is a red detector. The worksheet is saved as the first image below. The knob is used to adjust the Image Threshold block, adjusting the sensitivity of the red detection.
Figure 1: Red Detector Block Diagram Worksheet using inverted G, B color planes
In the above worksheet, Figure 1, the Red Channel (desired color) is used along with the inverted (negated through the subtract block function) Green Channel as one input to the Image AND function. The other input to the AND is the Red Channel combined with the inverted (negated through the subtract block function) Blue Channel. The resulting output of the AND function is an image which is inherently RED and NOT GREEN and RED and NOT BLUE, or just RED. Notice the threshold block used to set the discriminating level for the RED color.
The following worksheet, Figure 2, is another Red Detector that was designed in a different manner using Logical AND blocks and Image Threshold blocks on all color planes. It works in a similar fashion, with the Image Threshold parameters set to favor the color Red and to discriminate against other colors.

Both of the above worksheets use a standard CCD camera as its image source (note standard frame grabber function). In addition, with the Professional Editions of the Hypersignal products, these worksheets can easily become stand-alone applications using the included Application Builder - HAppI Wizard.
This worksheet, built in Hypersignal Block Diagram, requires the optional Image Processing Library. The optional library would be necessary as well if built in Hypersignal RIDE. If this worksheet were to be built in the Hypersignal ImageDSP environment, no optional libraries are necessary as Hypersignal ImageDSP is designed towards image processing applications such as this as well as many others.
Example 2: A Motion Detector
The worksheet below, Figure 3 - motiondet.lst, is a motion detector which uses a Delta Frame technique to calculate the energy of motion. The knob is used to adjust a global parameter, Sensitivity, adjusting the sensitivity of the motion detected. A File Read block is set to play a wave file when motion is detected and will continue playing the wave file in an infinite loop until motion is not detected; this effectively allows for an ‘Annunciator’ type of user output. The display labeled “Area of Motion” accents in the color red the area of the image where motion was detected.

Figure 3: Motion Detection Example using a Delta Frame technique
Again, this worksheet can easily become a stand-alone application for Windows 98/95/NT with Professional Editions using the Application Builder - HAppI Wizard. After setting the necessary blocks in place and running the worksheet through the HAppI Wizard, we have created the below application which will automatically work on any PC which has a standard PC-based Video Camera attached (and a sound card for the audio portion of the application).

Figure 4: Stand-alone application created with Professional Editions
Remember, this worksheet, built in Hypersignal Block Diagram, requires the optional Image Processing Library. The optional library would be necessary as well if built in Hypersignal RIDE. If this worksheet were to be built in the Hypersignal ImageDSP environment, no optional libraries are necessary as Hypersignal ImageDSP is designed towards applications such as this.
Example 3: Object Tracking
The below worksheet, Figure 5 - obtrckr.lst, is an object tracker. This worksheet will automatically identify a moving object based on the parameters of the Object Tracker block and either identify it by merely highlighting the detected object or both highlighting the object and placing a cross-hair at the center of the object. As seen in this worksheet, the two digital displays in the lower right-hand corner of the worksheet represent the row-value and the column-value of the center of the detected image. The upper left-hand corner of images within any of the Hypersignal environments is represented as (0,0).

Figure 5: Object Tracker for Image Processing
In the case of this worksheet, the Object Tracker block is set to be so sensitive that a small part of the original image, which happens to be a reflection in a window, is detected as having a moving object. Again, this worksheet uses a standard CCD camera as its image source. As in the previous examples, this worksheet can easily become a stand-alone application using the Application Builder - HAppI Wizard found in the Professional Editions of Hypersignal software products. Again, this worksheet requires the optional Image Processing Library.
Example 4: Object Counting
In the final example, the worksheet in Figure 6 - machvisn.lst, implements an object counter. This worksheet identifies and counts the number of objects in the image based on how the user sets the parameters of the Object Counting block. The Object Counting block detects and counts objects of a certain size, specified by the parameters Minimum Area and Maximum Area. This block contains two output channels. Output Channel 0 is a single value (an integer) containing the number of objects detected. Output Channel 1 is an image with the same dimensions as the input channel; the output image "highlights" the objects that were detected and counted.

Figure 6 – Object counting example, counting coins
In the case of this worksheet, the Object Tracker block is used to detect the second quarter from the top of the image. This worksheet uses a bitmap file as its image source and is typically included as one of the standard examples with the Image Processing Library or the Hypersignal ImageDSP development environment.
Again, this worksheet requires the optional Image Processing Library and can easily become a stand-alone application using the Application Builder, which is included in the Professional Editions of Hypersignal software products.
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
