Digital Camera Basics

Publish Date: Feb 15, 2012 | 102 Ratings | 3.91 out of 5 | Print

Overview

Digital cameras have become increasingly popular for use in machine vision systems thanks to their accuracy, high frame rates, large image sizes, and the ability to change attributes of the camera programmatically. This document describes the basic concepts of digital cameras and how they interact with IMAQ hardware and NI-IMAQ software.

Table of Contents

  1. Anatomy
  2. Taps
  3. Camera Communication
  4. Signal Types

1. Anatomy

The three most important types of digital signals that come out of a digital camera are the data lines, the pixel clock, and the enable lines.

  • The Data Lines are parallel wires that carry digital signals that correspond to pixel values. Digital cameras typically represent one pixel with 8 bits, 10 bits, 12 bits or even 14 bits. Therefore, it takes 8, 10, 12, or 14 digital lines to represent one pixel. The number of lines per pixel is referred to as the pixel depth. All image data is transferred to an image acquisition device on these lines at the same time, and is constantly toggling up and down.
  • The Pixel Clock is a high frequency pulse train that determines when the data lines have valid data. On the active edge of the pixel clock (which can be either the rising edge or the falling edge, depending on the camera), the digital lines should all have a constant value that is input into the image acquisition device, which latches in the data. The data changes to the next pixel value before the next active edge of the pixel clock, so that the next pixel value will get latched into the image acquisition device. The pixel clock frequency determines the rate pixels are acquired.
  • The Enable Lines are used to determine where the pixels are located in the image. The H-Enable (also referred to as the HSYNC or Line Enable signal) is active while an entire row of pixels is coming in. At the end of that row of pixels, the H-Enable goes inactive until the beginning of the next row of pixels begins. Another signal, the V-Enable (also referred to as the VSYNC or Frame Enable signal), is active during the entire frame. After one frame is done, the signal goes inactive until the beginning of the next frame. Enable signals can be either active high or active low. Some cameras' Enable Lines are edge-sensitive instead of level-sensitive, meaning that they use the rising edge of timing signals rather than the level. and National Instruments image acquisition devices are designed to work with level-sensitive enable lines and edge-sensitive pixel clocks.


Most digital cameras use a CCD (Charge Coupled Device) sensor to acquire images. The CCD is composed of thousands of small sensors that absorb photons while the shutter is open and build up an electrical charge. When the camera takes a picture, it discharges the CCD elements and converts the voltages into digital data in the camera. The CCD elements form a square or line with each element corresponding to a pixel.
There are two major classes of cameras -- Line Scan and Area Scan. Line Scan cameras use a single row of CCD elements. Also, since there are only lines, Line Scan cameras only require the H-Enable signal. Area Scan cameras feature frames with a defined width and height and use both the H-Enable and V-Enable signals to construct their frames. Below is an image of these two types of cameras with the enable signals and pixel clock. The following figure represents the enable signals and pixel clock signals for Line Scan and Area Scan cameras. Note that the data lines in the figure may change between each active edge of the pixel clock. The data on the lines during the active edge of the pixel clock, when the H-Enable and V-Enable signals are active, will be latched into the image acquisition device.


Figure 1. Line Scan camera with the valid data on the falling edge of the pixel clock.


Figure 2. Area Scan camera that is 12 x 4 (12 pixels per line and 4 lines per frame)

Back to Top

2. Taps


Increasing the speed of a digital camera's pixel clock or acquiring more than one pixel at a time can greatly increase the camera's acquisition speed. A camera that latches only one pixel on the active edge of the pixel clock is known as a single tap camera. A tap, or channel, is defined as a group of data lines that bring in one pixel each. Some cameras have multiple pixels on separate data lines that are all available on the same active edge of the pixel clock. These cameras are called multi-tap cameras, and digital cameras are available with as many as 4 taps. This technique requires more data lines, but allows for faster transfers.

The IMAQ 1422 Series devices features 16 digital lines, and the IMAQ 1424 Series devices features 32 digital lines. Therefore, an IMAQ 1422 device can support cameras with one 16- bit tap or two 8-bit taps, and an IMAQ 1424 device can handle a single 32-bit tap, two 16-bit taps, or four 8-bit taps. IMAQ devices require a tap to be a multiple of 8 bits, so that even if a camera only has 10 bits per pixel, the device will require a tap of 16 bits to handle the data and ignore the upper 6 bits.

There are several different configurations multi-tap cameras use to store data. A single tap camera stores data beginning with the top left pixel and moves to the right before moving down to the next line, continuing in this manner until the last line is completed for that frame. The camera then starts acquiring the pixels at the top of the next frame. The following figures illustrate different storage configurations used by multi-tap cameras.


Figure 3. Tap illustration

Back to Top

3. Camera Communication

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.)

Serial Commands 
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.

Control Pulses
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. 

Image Change 
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.

Camera Files
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.

See Also:
NI Camera File Generator

Back to Top

4. Signal Types


There are four types of digital signals used to send the image data to your image acquisition device.

  • TTL is a single-ended, 0 to 5 V signal. It can travel only about 1 meter (6-8 feet) reliably. Due to the large voltage swing, the signal cannot maintain pixel clock frequencies above 20 MHz. TTL signals are not as common because of these limitations.
  • RS-422 is a differential signal that can travel about 6-8 meters (18-24 feet). It has the limitation of 20 MHz maximum for the pixel clock. This type of signal is typically used for digital cameras that do not require pixel clocks faster than 20 MHz.
  • LVDS (Low Voltage Differential Signal) is a differential signal with a lower voltage swing. The differential property allows for 6-8 meters (18-24 feet) of digital data integrity, and the lower voltage swing allows the signals to have greater than 20 MHz frequencies. Cameras that require faster pixel clocks use LVDS signals.
  • Camera Link is a new digital standard that sends back serialized data instead of parallel. All bits pass through a converter onboard the camera, which places all of the data on a single line. The device then sends this single line back through a converter to return the data to the camera. This standard allows for thinner cables and uses a standard connector. The Camera Link standard can support pixel clocks greater than 20 MHz and can travel up to 10 meters (30 feet). Camera Link's enable lines use the LVDS signal. Camera Link eliminates the burden of specialty cables, since the Camera Link cable is compatible with every Camera Link camera and image acquisition device.


The table below lists the boards that support the four digital formats.

Note: The IMAQ 1424 and 1422 Series devices each have a RS-422 and LVDS version. 

IMAQ PCI/PXI-1422 
RS-422 777959-01
LVDS 777959-02

IMAQ PCI/PXI-1424
RS-422/TTL 777662-01
LVDS/TTL 777662-02

IMAQ PCI-1428
Camera Link 777315-01

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit