Digital cameras often allow you to change their functionality through serial commands or control signals. You can modify camera attributes through Measurement & Automation Explorer (MAX) by right-clicking on the camera, selecting Properties, and clicking on the Advanced tab. You can view and change all of your camera's properties on this tab. You can also access these properties programmatically using the function imgSetCameraAttributeString or the IMAQ Set Camera Attribute VI in LabVIEW.
Note: Be sure to check for the correct spelling and attribute order when you are setting your camera properties. Always set higher-level attributes first(i.e. before changing the Pulse Width, set the Shutter Control and Shutter Speed to the correct settings.)
Digital cameras are controlled using either serial commands or control pulses. These methods use the same VIs or function calls. NI-IMAQ and your camera's camera file manage the serial commands and control pulses as required by your camera. The IMAQ 1422 and 1424 Series devices feature a UART chip designed for serial communication with digital cameras. The high-level commands called with the Camera Attribute functions allow you to set these properties without explicit knowledge of the low-level commands. The camera file also makes the use of serial commands and control pulses transparent.
Another method for controlling the camera is to send digital control pulses. Exposure time is a good example of an attribute that may be controlled with control signals. Some cameras may expect a rising edge before they open the shutter and the shutter stays open until the signal has a falling edge. As soon as the falling edge occurs, the shutter closes and the camera begins transferring the digital data to the image acquisition device. The length of the control pulse determines the shutter time, while the control pulse frequency determines the frame rate.
Note: You can set the shutter with serial commands, control pulses, or both. See your camera documentation for more information on which method your camera uses.
Some properties change how the image is formatted. These changes can cause timeout errors. For example, if you are expecting a 1000 x 1000 image, and you change an attribute that changes the image size to 500 x 500, NI-IMAQ will continue to look for a 1000 x 1000 image, resulting in the error message.
A common example of an attribute that changes the images size is the binning attribute. Binning is a method of combining the charge of two consecutive pixels and returning a single pixel value with a greater charge, producing a smaller, brighter image. Since this attribute affects the image, make sure your window is reduced appropriately so that the reduced image size does not cause an error. While camera attribute functions send the serial command or control pulse and notify NI-IMAQ of the attribute change, you must still change the acquisition size.
Note: If the cable coming from the image acquisition device does not have the serial lines connected (often because the serial lines are housed in the power connector of the camera), change the window size to fit the image and then send the serial command using your operating system's COM port.
A camera file tells NI-IMAQ how the camera organizes the pixels, what attributes the camera supports and how to change them, either using serial commands or control pulses.
Due to all the variations in digital cameras, such as how they format the data and the modes they support, NI-IMAQ requires a camera file to specify how the data is coming in and what serial commands and control pulses should be sent to the camera to change the mode or attributes of the acquisition. You can check the list of Compatible Digital Camera Files to see if there is a digital camera file available for your camera. If you do not see the camera listed here, the NI Camera File Generator can help you create your own custom camera files with an easy to use user interface.
NI Camera File Generator