Die Flagge des Marasek

Dekostreifen

Deutsch

Current Texts Comic Imprint Calendar Search PHP-Classes Container-Wizard main.s21

Categories

Class Library
Computers
Gaming
Global Politics
Programming
Society
Weblog
World Outlook
{{login}}

raw, dcraw, really raw

Permalink
Previous: It's rarely the language...Next: Blu-ray-Konsumverweigerung
Assigned keywords: foto

Recently, I started to question myself about "real raw" in the sense what the sensor sees. As I started with IR fotography, I came to notice that the usual way of white balancing led to somewhat erratic results. So I found out that there are two major manipulations of the sensor data done by dcraw: color matrix and white balance.

Color matrix treats the color channels with further increasements, mostly red. This is because of the IR blocking filter before the sensor which discriminates strongly against visible red light as well as a lower sensitivity of the sensor in the blue area, at least according to the official specs delivered by Kodak (yes, I've read them).

The second manipulation is done by white balance. In order to get a white balanced picture, the user defines a certain spot as "white" and dcraw (as any other raw developer) then shifts the color channels in a way to attain white (or gray) at that certain point.

Now both measures are somewhat problematic. When using the color matrix, especially red is amplified - and with that amplification, noise becomes increased as well. And with white balancing, strong channels (usually blue and green in daylight, or red and green in incandascent) may as well start to clip while the much darker third channel becomes amplified and therefore more noisy as well.

This becomes especially apparent under unusual conditions, the first example being "Low Pressure Sodium" lamps. They generate a nearly monochromatic light peaking at some 589.3 nm wavelength, which results in next to no blue recorded on the image. When white balancing such a picture, the results can be rather awkward, especially with high ISO values: wild blue noise appears all over the image.

The second example is IR photography, which does not deliver colors in the common sense and therefore negates the very meaning of white balance and color matrix altogether.

With common images, white balance is of course quite practical and color matrix adds to a more vivid image; but even then, there is another reason why to refrain from using both. When you plan to not even use color and turn your image into a black and white one using channel mixing, it is a good idea to get the most raw image as possible. You will do a channel balance anyways, so having a greenish picture to start with does not hurt, but you don't start with additional noise due to color increasement.

Oh, and here is how to do it:

dcraw -4 -r 1 1 1 1 -o 0 -M -k 0 -S 4095

The options explained:

  • -4 will give you a 16 bit file
  • -r does white balancing by scaling the image's color channels differently. 1 in every channel equals no white balancing.
  • -o determines what color space should be used for output. 0 is no color space.
  • -M determines whether a "color matrix" should be applied or not.
  • -k sets the black point. Images usually won't have black pixels in the sense of "0,0,0", but have, say, 15 as the darkest value. Usually, dcraw will stretch an image in a way to write that lowest value as 0 and shift the remaining pixels accordingly. This enhances contrast.
  • -S same as black point, only for white; dcraw will take the brightest pixel here for reference. I took 4095 here, which is the brightest pixel theoretically possible in a 12 bit file; this will stretch the 0-4095 range to 0-65535, the amount of values in a 16 bit file.
    You possibly want to omit the last two options and leave that to dcraw to get better results, but we're talking about getting "total raw" images here so I added them.
    Also, if you plan to really work with the raw data, you might use -S 65535. This will not stretch the 12 bit range to the 16 bit range, resulting in a very, very dark picture. Do not try to edit that with a image processing program that is incapable of handling 16 bit data!

Comments

Please note: comments posted won't be visible immediately, as they will be checked for harmful content.

* Title  
* Nickname  
* Comment