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
NI-IMAQdx Properties.
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.
Note: Some attributes can not be set while acquiring, for example, the width and height of the image. You can use the following code to identify what functions are writable before and while acquiring.
The IMAQdx Configure Grab.vi configures and starts a grab acquisition so if you try to set a non-writable property while acquiring, then you will receive an error.
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:
- Call the IMAQdxEnumerateAttributes2 function with the attributeInformationArray parameter set to NULL. The necessary size is then stored in count.
- Allocate count with the given size.
- 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 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.