One-Shot Color and the Bayer Array

Most astronomical cameras use monochrome sensors, and require individual shots taken through filters to be combined to produce color images. DSLR cameras were designed for one-shot color photography. The individual pixels in the sensor are covered with an array of alternating red, green, and blue color filters known as the Bayer matrix.

Typical Bayer Matrix

The Bayer matrix allows the camera to instantly create a color image, but at some loss of resolution. The camera sacrifices some spatial resolution in exchange for the ability to capture color in one exposure.

The raw data coming from the chip looks like a black and white picture with a speckle pattern. The pattern is due to the different color filters; each pixel is seeing only a particular color. To convert this to a color image, each pixel must have a red, green, and blue value. This means that software must interpolate the missing color values. This process, called "debayer" or "color conversion" takes place inside the camera when it is set to make JPEG images, and must be performed by software when RAW images are collected.

This conversion is performed by looking at adjacent pixels, and estimating what the two missing colors should be. Many different algorithms have been proposed for doing this, but all are compromises.

When the debayer function is done inside the camera, the camera also converts the image from a typical 12 bits per pixel to only 8 bits per pixel (required by JPEG). Neither the bit depth nor the assumptions and formulas used natively in the camera to convert the images are suitable for astronomy. Also dark subtraction is best performed prior to conversion. For these reasons, astronomical images should always be captured in the RAW file format, dark subtracted, and then color converted using the Convert RGB command.

Prior to DSLRs, "raw" format usually meant an array of numbers with no header. DSLR cameras actually produce a "raw" image that is in a proprietary image format; these formats often vary from model to model, not just brand to brand.

MaxDSLR can read several hundred different variations of these file formats from either your camera's Compact Flash memory card, or directly from the camera's memory. The images are then saved in the FITS image format, which is the standard for astronomical images.

Since every sensor varies a bit in their color sensitivity, it may be necessary to adjust the color balance during conversion. See Creating Color Images for more information and recommendations for DSLR cameras.