[ptx] Off-Topic: kelvin and red/blue balancing

Ed Halley ed at halley.cc
Sun Feb 8 21:09:14 GMT 2004


This is slightly off-topic for Hugin, but there seem to be a fair number
of color-savvy mathematics folks who are on this list.

Dave Coffin has provided a file called dcraw.c which offers access to
many camera "raw" formats.  It is a work of reverse-engineering in many
cases, because manufacturers don't fully document each camera format.

To support conversion at its highest quality, dcraw.c needs to know the
white balance parameters.  These are performed by multiplying red
samples and blue samples by two multipliers.

    final[r] = sample[r] * factor[r]
    final[g] = sample[g]
    final[b] = sample[b] * factor[b]

I want to be able to specify a given Kelvin temperature, such as 5500
for daylight, and determine the proper red and blue multiplier factors. 
I expect there are per-camera factors which relate to sensor biases, but
I would like to figure a function that gets much closer to the mark.

    final[r] = kelvin2red( sample[r], kelvin, camera )
    final[g] = sample[g]
    final[b] = kelvin2blue( sample[b], kelvin, camera )

Google has not been fruitful for me.  Does anyone have links which could
help me turn a kelvin figure into a proper red-correction factor and
blue-correction factor?

-- 
[ e d @ h a l l e y . c c ]



More information about the ptX mailing list