Example Code

Toggle between Multiple USB Camera

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • Machine Vision


  • LabVIEW


  • NI Vision Acquistion Software

Code and Documents



This example acquires images from a gige or usb camera using the IMAQdx driver which is part of the Vision Acquisition Software. It's possible to toggle between multiple cameras by selecting the camera name input.


Some USB camera drivers are not capable of acquiring from two cameras simultaneously.  Since the IMAQdx driver goes through the camera driver, if the camera driver is unable to acquire from multiple cameras simultaneously, then IMAQdx will not be able to acquire from these cameras simultaneously.

But if you would simple like to be able to toggle between multiple USB camera, you can use the following example for it.



Vision Acquisition Software 2009 "or compatible"

LabVIEW 2009 "or compatible"

GIGe or USB 2.0 Camera

Steps to Implement or Execute Code

1.) Make sure the required software is installed and activated

2.) Test the camera using Measurement & Automation Explorer (MAX)

3.) Close MAX and open "Multiple USB Camera Acquisition 2009.vi"

4.) Select your camera under Camera Name

5.) Run the LabVIEW program

Additional Information or References

Note: To toggel between multiple cameras please select different cameras using the "Camera Name" input.

NI-IMAQdx Compatibility with Different LabVIEW Versions

Is My Camera Supported by National Instruments?

**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit thisdiscussion thread**

Andy Chang
National Instruments
LabVIEW Control Design and Simulation

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.