[argyllcms] Re: mathematics question - colprof models and cameras

  • From: Graeme Gill <graeme@xxxxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Thu, 15 Dec 2011 00:21:43 +1100

Stephen T wrote:
> Matrix (-m) I think I understand: it's a 3x3 matrix that converts linear RGB 
> to (linear) XYZ.
> 
> Now, what is the purpose of the matrix in the "+ matrix" models (-G, -g, -S, 
> -s) ? Are the
> gamma/shaper curves used to "pre-condition" the data before going into a 
> matrix to XYZ or?

Hi,
        profiles model the behaviour of the device. If the device is linearly 
additive,
then (in theory) all one needs to do to model it's 3 dimensional behaviour 
accurately
is to convert the channel values into linear light quantities and then transform
to XYZ using a 3x3 matrix. So the other options choose what sort of non-linear 
per
channel curve to use. A gamma curve has fewer degrees of freedom than a shaper 
curve,
which may be an advantage or disadvantage depending on the number of sample 
points
and the nature of the device per channel non-linearity.
A single curve applied to all channels can have certain benefits in some 
situations,
for instance if the device per-channel non-linearity is known to be identical in
all channels (reduces degrees of freedom and hence scope for errors).

In practice the apparent input devices behaviour may not be additive. This can 
be due
to unevenness in the test image, flare, metameric mismatch of the input devices
sensitivities, etc.

I'm not really sure what you mean by "pre-conditioning" - profiling is about 
modelling
device behaviour, not about changing the behaviour of anything. Changing a 
devices
behaviour is called calibration, and is best regarded as a separate process.

> Look-up tables I also understand. I also know that Lab is a non-linear 
> colourspace, XYZ is
> linear.

XYZ is linear light, which can be an advantage if the underlying device 
behaviour is close
to linear. But XYZ is also a highly non-perceptually even space, so the evenly 
spaced
grid of a cLUT can be at a disadvantage in XYZ space. L*a*b* by contrast is 
closer
to perceptually linear, so the grid is closer to being perceptually linearly 
distributed,
so the choice between XYZ and L*a*b* is not clear cut. An additional factor is
the per channel curves. On the device side these can be tuned to turn the 
(possibly
non-linear light) values into linear light values, making an XYZ grid cell
behaviour more linear. On the PCS side the per-channel curves can be used to 
encode
linear XYZ space to a non-linear light but perceptually more even XYZ space, 
mitigating
some of the disadvantages of the even grid spacing when transforming in the 
reverse direction.

> Now, which model's are suitable for camera profiling (140 patches) and how 
> should I precondition
> the data (in ufraw)?

Hard to say as it depends on your exact situation. You really have to try a few
different options out and see which best suite your purpose. 140 patches 
though, is
not very many for a cLUT type profile. Again, I'm not sure what you mean by 
"precondition".

> I know that the matrix model is only for linear (gamma = 1) RGB images.

> It is not clear whether linear or non-linear (gamma = 0.45 == 2.2) is better 
> for the other model
> options. It seems that errors are a bit lower when I precondition that data, 
> which doesn't make
> sense to me for the "+ matrix" models.

When using an additive multi-dim model (such as matrix of XYZ cLUT), then the 
per-channel
curves will tend to cause a best fit by converting the device values to linear 
light.
So any gamma added to the native device behaviour will tend to be undone by the 
profile,
particularly for a matrix model. The curves are not likely to be perfect in 
this regard
though, and errors could be magnified with certain combinations.

> So far, it seems that gamma+matrix works fairly well in comparative 
> evaluations using real word
> images (viewed side-by-side on a calibrated and profiled, wide-gamut 
> monitor). My matrix profile
> has a slight colour cast. The XYZ lut had the lowest errors but also seems to 
> have a slight
> cast.

You're concatenating two profiles, so you naturally concatenate any errors in 
the two
systems. Typically such systems are not setup to be absolute colorimetric, so 
there is likely
to be a white point shift, making side by side comparison difficult.

Graeme Gill.

Other related posts: