Changing Camera Drivers Programmatically in LabVIEW

Updated Nov 21, 2023

Reported In

Driver

  • NI-IMAQdx

Issue Details

I am using a camera that can be used with multiple drivers, including IMAQdx. I want to be able to switch between these camera drivers programatically in LabVIEW. How do I do this?

Solution

IMAQdx includes a utility VI that can be used to programmatically change the driver associated with a camera. The VI can be found in the IMAQdx.llb library located at the following path: 

C:\Program Files (x86)\National Instruments\LabVIEW 20XX\vi.lib\vision\driver\IMAQdx.llb
or
C:\Program Files\NI\LVAddons\niimaqdx\1\vi.lib\vision\driver\IMAQdx.llb

In this library, you will find IMAQdx Switch Camera Driver.vi. You can use this VI to switch the drivers associated with the camera programmatically. Add this to your code as a usual subVI.

The VI has the following connections: 

  • Driver Name: This is the Device Key currently associated with your camera that you wish to change. It can be found in Windows Device Manager. In the list of devices in Device Manager, locate your camera, right-click on it, then go to Properties -> Details -> Driver Key. Here is what it might look like if you have a Basler USB3 camera that is currently associated with the Basler USB3 Vision Camera driver:
Basler ace USB3 Vision Camera Properties.png
  • Driver Description: This is the driver description of the driver to which you want to switch and must match the Driver Description property for that driver, as defined in the driver INF file. For example, to switch the camera to use the IMAQdx USB3 driver, you would enter: NI-IMAQdx USB3 Vision Device
  • Error In/Out: A typical Error in/out in LabVIEW

switch screenshot.png

Additional Information

When entering the Driver Key into the Driver Name input to this VI, you can either enter the generic Driver Key, or the specific instance of the key associated with your camera. When you get the Driver Key property of the camera in Device Manager, it will be formatted as follows: {[generic driver software key]}\[4-digit instance number].

For the camera shown in the image above:
  • The generic driver key: {79bfeecb-947f-11e1-bc58-001b2163ef96}
Entering this value as the Driver Name input would switch the driver for all connected cameras currently using this same driver.
  • Driver key with specific instance number: {79bfeecb-947f-11e1-bc58-001b2163ef96}\0000
Entering this value as the Driver Name input would only switch the driver for this specific camera.