How do I acquire and view 16-bit images from my camera?
Last Revision Date: 6/3/2014
This article describes how to acquire 16-bit-per-pixel images using the FlyCap demo program, and how to view them using third-party image viewers.
Data Format and Actual Bit Depth
Most imaging and stereo products can output 16 bit-per-pixel (bpp) images. In all cases, however, the number of useable bits is limited by the resolution of the analog-to-digital converter. For example, if the camera uses a 12-bit A/D converter, the maximum theoretical bit depth is 12 bits. To determine the number of bits of useable image data, and resulting signal-to-noise ratio, that is actually being produced by the A/D converter.
The byte alignment (endianness) of 16 bpp images is controlled by the Y16_Data_Format field of the IMAGE_DATA_FORMAT register 0x1048. Consult the Teledyne FLIR Machine Vision Camera Register Reference for more information. To correctly view 16 bpp images using third-party imaging software, such as National Instruments Measurement and Automation Explorer, it may be necessary to configure the software bit and byte alignment parameters.
Enabling 16 bpp Video Modes
The FlyCap2 demo program that is included with the FlyCapture2 SDK can be used to put the camera into a 16 bpp mode. To do this, open the Camera Control dialog and navigate to the Standard Video Modes dialog and select any Y16 format and frame rate. Alternatively, navigate to the Custom Video Modes dialog and select any Mono16 or Raw16 pixel format.
NOTE: For color cameras that do on-camera color processing, such as the Flea2, the raw Y16 / Mono16 data is converted on the camera to monochrome. To configure the camera to output raw Bayer data, set the Bayer_Mono_Ctrl bit in the IMAGE_DATA_FORMAT register 0x1048. Consult the cameras Technical Reference Manual for more details.
Saving and Viewing 16 bpp Images
The Portable Grey Map (.pgm) file format can be used to correctly save 16 bpp images. However, you may encounter unexpected results from many of today’s available imaging tools when trying to view them. The reasons for this problem include:
-
- Many image viewers are unable to open 16-bit images.
- Other image viewers can open 16-bit images, but convert them to 8-bit images in the process.
- Some recent viewers can open 16-bit images, but assume a big endian byte order, whereas our 16-bit images are encoded in the endianness of the operating system; in the case of Intel platforms, this byte order is little endian.
The following are some free image viewers that correctly display 16 bpp images:
-
- XV (Linux)
- ImageJ (use the Byte Swapper plugin for byte alignment) (Windows and Linux)
- IrfanView (Windows)