1. Locate the appropriate hardware and software for the laboratory. This includes a video camera with an appropriate lens attached. A BNC cable to connect to the computer. A computer with the National Instruments IMAQ PCI-1408 vision card and IMAQ software installed.
2. We will start by verifying that the vision system is working properly. To do this run the “IMAQ Configuration Utility”. You should see a screen that shows the computer and PCI-1408 card. Click on the ‘+’ to the left of the card and you should see four input channels appear. The first of these is ‘channel 0’, click on it. Next, select “Aquire”, “Grab”, a window should appear that shows a video feed. Adjust/focus the lens until a clear image appears. Note that the lens attached is a TV lens. For small distances (less than 2-3 feet) the lens will be very sensitive to focus, when a longer focus is used it will be much less sensitive. Explore the software settings for the camera. Feel free to change values, but record the original value so that it may be changed back. When you feel comfortable that the video images are being captured properly, continue to the next step.
(From left to right) First create a string, and enter ‘test’ or something else. Next create the ‘IMAQ’ icon using “IMAQ Vision”, “Management”, “IMAQ”. This will create a generic place to store images. At this point the image size, etc is not important. Now that we have a place to store the image, we can grab images from the camera with the ‘snap’ icon found at “Image Aquisition”, “Snap”. Finally we can display the images using the last icon found at “IMAQ Vision”, “Display (basics)”, “IMAQ WindDraw”. Connect these together and run the vi. You should see an image from the camera. Notice that these icons are doing a lot that is not on the screen. The vision add-on to Labview does not fully follow the philosophy of graphical programming. Things like the display window are not shown in the panel where they should be. These ‘cheats’ are necessary because of the huge amount of data required for vision tasks. Take some time to explore the other vision tools, and try modifying the vision program.
4. Close the vi and do not save changes to any other vi (this could save some settings permanantly). Next, use “Open vi” and open “examples”, “vision”, “barcodedemo.vi”. Run the vi. An image of a barcode should appear. Use the mouse to put a rectangle over the bar code. Then accept the Region of Interest “ROI”. After this the program will use images saved on disk to test the routine. The codes should match the displayed images. Stop the vi and look at the diagram to see the general operation - it is set up to use a sequence. Notice that the first frame in the sequence pulls an image from a file, and displays it on the screen. The next couple of frames deal with getting the region of interest. The fourth sequence (3 of 0 to 4) captures images and decodes the barcodes. The last sequence is used to release the vision memory, etc. Notice that the images are being supplied by a function called “simu GRAB”, replace this with the normal snap routine and run the program (put a vi in front of the camera). You should now see the images, but they are not decoded properly. Notice that the barcode icon has an integer digit input of ‘3’, you will need to change this value to get the barcodes to decode properly.
5. Close the vi (don’t save any changes). Open the example vi “caliperdemo.vi”, and run the vi. This vi can be used to check the presence of objects. Draw lines across the image. Each point where the line goes from light/dark or dark/light an edge will be detected. If the line is accepted you will see it appear on the list, you will want to change the number of edges. You can have more than one test line. When done run the test and see how it behaves. Look at the diagram for the vi and modify it to use the camera (as you did for the barcode reader).