Jonathan Thomson's web journal

Determining Camera’s Gray and Taking RGB Flats November 10, 2010

Taking flats with a color camera can be difficult because the spectral content of the illumination source and the colored filter array will cause a flat frame taken without white balance (e.g. a raw image) to have a color cast. Additionally it can be difficult to get each channel’s histogram peak to fall within 1/3 and 2/3 full-scale, where the CCD is most linear. The solution is to use an illumination source, which may not look gray to the human eye, but definitely appears gray to the camera. As you can see in the image below, even though the color displayed by the laptop’s LCD is magenta, the camera’s LCD is displaying gray.


The script find_camera_gray_test works by assuming the relationship between the RGB color displayed on a monitor (stimulus) and the RGB color of a photograph of the monitor (response) can be related by nine multipliers, three for each channel. For example, the multipliers that determine the red component of the response are mrr, mrg, and mrb. If three stimulus images are photographed then a set of three linear equations can be setup that allow the red component multipliers to be determined.


Likewise, two more sets of equations can be used to determine the green and blue multipliers. The nine equations can be described using matrices:


The stimulus, S, can be controlled by specifying three different RGB values for the monitor to display. The response, R, can be measured by finding the mean gray level of each channel of the response photograph. Therefore, the multipliers, M, can be found.


Once the multipliers have been solved for, one can determine which stimulus will cause a gray response.


To use the script find_camera_gray_test, first use a paint program to create three images: the first pure red (255 0 0), a second pure green (0 255 0), and a third pure blue (0 0 255). Then take one photograph of each image while making sure that the pure color fills the entire camera’s field of view. Next, edit find_camera_gray_test so that it can locate the photos. Finally, run the script to find the RGB color to display on your monitor that will appear gray to your camera. This might not be the exact color needed to produce a gray flat but it will be a good starting point.

A diffuser should be used to prevent the monitor’s pixel pattern from being captured in the flat. I used a piece of milky transparent plastic to replace the diffuser from a white balance lens cap because its raised lettering would ruin the flat.


Producing flats using an LCD monitor


Continue Reading

>>>Next — Results>>>

<<<Previous — Noise Reduction<<<



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s