Programmatically Get and Set Attributes with NI-IMAQdx

Updated May 4, 2018

Reported In

Software

  • LabVIEW

Driver

  • NI-IMAQdx
  • NI-IMAQ

Other

IMAQ for IEEE 1394

Issue Details

  • How can I programmatically set my camera attributes, such as brightness, shutter speed, and gain, using NI-IMAQdx? 
  • I recently migrated from NI-IMAQ for IEEE 1394 to NI-IMAQdx. I formerly used IMAQ1394GetAttribute for C or the Attr property with the IMAQ 1394 property node. Where can I find these options in NI-IMAQdx?

Solution

See the information below to programmatically set your camera attributes in LabVIEW and in text-based languages. 
 

Using LabVIEW

Use the IMAQdx Property Node to set camera attributes in LabVIEW. To find the IMAQdx property node: 
  • Navigate to Vision and Motion functions palette >> NI-IMAQdx
  • Drop a general property node on the block diagram, right-click and navigate to Select Class >> IMAQdx
For details on how to configure the property node, please refer to Camera Attributes in LabVIEW in the NI-IMAQdx Concepts Help document (NI-IMAQdx Concepts Help >> Using NI-IMAQdx in LabVIEW >> Acquisition Types >> Camera Attributes in LabVIEW). The link will download a zip file of the help document onto your computer.

If you are using a GigE Vision Camera, please refer to Programmatically Controlling Camera Settings in the NI-IMAQdx Concepts Help document (NI-IMAQdx Concepts Help >> Acquiring from GigE Vision Cameras >> Programmatically Controlling Camera Settings).

The figure below shows an example of how an IMAQ1394 property node vs. an IMAQdx property node can be configured to change the level of brightness of a camera. 

 

Using Text-Based Languages

Use the IMAQdxGetAttribute function call to get a particular attribute value or setting. If you are unsure of the exact name or value of an attribute, you can call IMAQdxEnumerateAttributes2 and IMAQdxEnumerateAttributeValues to return this data.

If you do not know in advance the number of attribute values that are available, you can get this information by completing these steps:
 

  1. Call the IMAQdxEnumerateAttributes2 function with the attributeInformationArray parameter set to NULL. The necessary size is then stored in count.
  2. Allocate count with the given size.
  3. Call this function again using the previously allocated array


You can do the same steps for IMAQdxEnumerateAttributeValues by setting the list parameter to NULL, which stores the necessary size in size. For more information regarding the use of these functions and other IMAQdx functions for text-based languages, please refer to the NI-IMAQdx Function Reference Help found in under National Instruments\NI-IMAQdx\Docs.

Additional Information

The NI-IMAQdx driver allows camera attributes to be dynamically obtained using a string input. The reason for this change is that with the IMAQ 1394 driver, all cameras were DCAM-compliant and had a specific set of attributes. With the IMAQdx driver, there are many more supported cameras with varying attributes. Therefore, instead of enumerating a set list of features, it is necessary for users to choose the available properties for their particular cameras. 
 

Additional Troubleshooting when using LabVIEW

​If you are getting error: -1074360305 attribute not supported by the camera or you are unsure of what attribute string to pass to the Active Attribute property, use the IMAQdx Enumerate Attributes VI to extract information on the exact string of an attribute, whether or not that attribute is readable or writable, and what datatype it can accept for an input.

The IMAQdx Enumerate Attributes VI populates all of the available properties for the camera, and can be indexed accordingly. The properties that show up are specific to the camera that is part of the session that the property node is receiving a reference to. 

For more information regarding the use of these functions and other IMAQdx functions for LabVIEW, please refer to the NI-IMAQdx VI Reference Help or refer to the Grab and Attribute Setup.vi in the NI Example Finder. The link will download a zip file of the help document onto your computer. 

 

WAS THIS ARTICLE HELPFUL?

Not Helpful