[argyllcms] Re: Gamma wrong for calibration curves?

  • From: Graeme Gill <graeme@xxxxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Tue, 05 Dec 2006 13:45:56 +1100

william.wood@xxxxxxx wrote:

The gamma is calculated as a truncated ideal gamma curve (ignoring black
point).

You can't ignore the black point to compute a truncated gamma curve,
that's the whole point. The idea is that an ideal gamma curve
response has a reading of 0 output for 0 input. Real devices
don't behave this way. There are several ways this could
be dealt with, one being to subtract the black level reading
from the calculations, the other being to assume that the
ideal curve is being truncated at the black end (ie.
that the device is adding an unknown input black offset to the input
value we're feeding it). The current software is working
on the second basis.

So the assumption is that the input value to the ideal
("internal") gamma curve is:

input value = actual input value * (1.0 - input black offset) + input black 
offset
or          = actual input value + (1.0 - actual input value) * input black 
offset

For instance, 2nd last column is:

Calibration source      0.00    0.25    0.50    0.75    1.00
-k1 -g2.2               0.42    9.65    33.27   74.09   132.54

Just taking the 0, 50% and 100% outputs:

Black response = 0.42/132.54 = 0.003169
50% response  = 33.27/132.54 = 0.2510

So the input offset to the non-truncated ideal gamma curve
that gives a black value of 0.003169 is:

input_black_off = Black Response ^ 1.0/gamma

The input value  on the non-truncated curve of the
actual 50% value is:

50% input value = 0.5 + (1.0 - 0.5) * input_black_off

and the gamma is:

gamma = log(50% response) / log(50% input value)

Now this is a recursive definition (I couldn't easily
figure out a closed equation), so starting with an
assumed gamma of 2.2, and iterating a few times I
arrive at a gamma of 2.228452:

input_black_off = 0.003169 ^ 1.0/2.228452 = 0.075605
50% input value = 0.5 + (1.0 - 0.5) * 0.075605 = 0.537802
gamma = log(0.2510)/log(0.537802) = 2.228452

This seems reasonable for a spot check, given that the
calibration is optimizing the overall shape to
comply with the target curve, minimizing the sum of
the squared delta E's (not gamma error), and keeping the
curve monotonic.

> Can you check my results and if they look ok, doesn't this indicate
> significant error in the generation of the calibration curve for g2.2?

I haven't gone over all your numbers, but to look at some others:

For -k0 -g2.6 I compute a gamma of 2.617475
For -k1 -g2.6 I compute a gamma of 2.640738
For -k1 -g2.4 I compute a gamma of 2.446436

so it seems to me it's working as designed.

Graeme Gill.

Other related posts: