The LabVIEW programming environment by National Instruments has an excellent addon package that is capable of performing a number of powerful image analysis and recognition operations. Even the core LabVIEW products contain capabilities for displaying, loading, and saving images in a variety of formats. Unfortunately, at the time of this writing, LabVIEW only inherently supports expensive hardware based capture devices, leaving image capturing and processing out of the hands of low-budget users.
The LabVIEW webcam library allows a LabVIEW program to capture images from any inexpensive imaging device, such as the excellent yet inexpensive Lego webcam. This functionality opens up a number of possibilities for the augmentation of collected data by images. For example, webcam images can be embedded in front panels for monitoring remote hardware or even for remote experimentation. As another example, webcam images can be processed for information that can then act as a trigger for other data collection operations.
Requirements
The driver has been tested to work with Windows 98, Me, 2000, and XP. On average, the driver is capable of returning images to LabVIEW at 7 FPS.
- LabVIEW 6i or higher
- Windows 98, ME, 2000, or XP
- Windows compatible webcam
FAQ
Has anyone contributed updates to the webcam driver or worked on another solution?
Yes. See the download section.
Are you still working on this library? Will you support me if I need help?
I no longer work with LabVIEW on a regular basis or have access to a copy of LabVIEW. I also have not worked on the LabVIEW webcam driver for a long time now. As a result, I feel that I am no longer able to offer useful support for it and will no longer be responding to emails with questions about the driver.
If you’re having problems getting it to work, please read the rest of the FAQ below. If the FAQ doesn’t solve your problems, then by all means download the package and modify the source code yourself to make it better. I’m sure someone can come up with a better driver that supports the newer Windows Imaging API rather than the much older Video for Windows API.
I’ve read this FAQ, tried all of the solutions, and the library still doesn’t work for me. What’s wrong with your code? Will you fix it for me?
It was never my goal to get this library working on all imaginable hardware configurations or with every version of LabVIEW. It served my purposes well when I needed it, so I decided to release it to the public. It should definitely be considered more of a proof-of-concept than a production ready library. If it doesn’t work for you or doesn’t meet your needs, improve it. That’s the beauty of open source.
My webcam won’t work with your library. All I get is a black image when I run your examples. Will it not work with my camera?
Make sure you have passed the correct driver number to the Webcam Initialize VI. You can determine what the correct driver number should be by running the Get Digitizers VI included with the library. It will return a list of webcam digitizer names and their associated driver numbers. Pass the driver number shown in this VI to the intialize VI.
The webcam image I see is completely wrong. It’s copied, stretched, the wrong color, the wrong size, etc. What’s wrong?
The Video for Windows (VFW) is used by the LabVIEW webcam driver to capture images from a USB webcam. Unfortunately, the settings for this driver can only be set by hand using a GUI dialog box. If you specify an image resolution of 640×480 in LabVIEW and have your driver set to capture 160×120, either a crash will occur or the image will be displayed incorrectly. To resolve the problem, run a typical webcam program that allows you to change the properties of your webcam. Match the resolution of the VFW driver to the resolution you chose in LabVIEW, and set the bit-depth to at least 24-bits.
This is a really annoying problem, and if anyone attempts to fix it, please let me know!
LabVIEW freezes or crashes after a program using your webcam library ends. I press the Abort button to stop the program. Why does it crash?
The Webcam Close VI must execute for the library to shut down properly. If you simply press the Abort button in LabVIEW while in a loop, the program immediately ends, and the Close VI outside the loop never executes, leaving the capture session running. Instead of using Abort, simply make a button on the front panel that is wired to the loop terminal. If you use only that button to stop the capture session, the Close VI will always run and crashes can be avoided (hopefully).
Download
The LabVIEW webcam library can be downloaded and used under the terms of the MIT License.
Philipp Spitzer has contributed an updated version of the LabVIEW webcam library that remedies some crash bugs. Click here to download his 1.4.1 version of the LabVIEW webcam library. This newer version requires LabVIEW 8 or higher.
Click here to download the original version 1.4 of the LabVIEW webcam library.
Installation and Use
See the README file included in the download for instructions on installing the library and running the examples. Read the FAQ for troubleshooting tips.