[argyllcms] Re: Profile input white not mapping to output white

  • From: Elle Stone <l.elle.stone@xxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Fri, 14 Dec 2012 10:01:28 -0500

dcraw + colprof + xicclu + a spreadsheet can be used to create a ti3
file, make a profile, and then modify the original ti3 file so the
resulting new profile is perfectly or almost perfectly normalized and
also color-balanced, without worrying about what the real color
balance really is.

The "-am" profile assumes the camera sensor responds linearly to
light, which is what the dcraw camera matrix (adobe_coeff table)
assumes. So "-am" is a good choice for a general purpose camera

Often target shots are underexposed, sometimes by two or three stops.
The resulting "-am" profile adds two or three stops of exposure
compensation. But a general purpose camera profile shouldn't
compensate for underexposure or underexposure.

Even if the target chart has a perfectly neutral patch for
color-balancing, colprof doesn't provide a way for the user to say
"this is the right color balance patch". One patch is indeed chosen as
"the" white point patch. But colprof seems to use all the patches
together to determine the actual profile white point.

Here's an example using an IT8 chart:

Process the raw file without doing any color-balancing (the
multipliers are all set to 1):
dcraw -v -r 1 1 1 1 -W -T -6 -g 1 1 -o 0 target.cr2

Crop as necessary, then create the ti3 file:
scanin -dipn -G1.0 -p target.tiff it8.cht R080505.txt

Make the first profile:
colprof -v -am -u -D"target-am-u" -O"target-am-u.icc" target

Use xicclu to determine the RGB values that correspond to Lab (100,0,0):
xicclu -s100 -fif -pl -ir target.icc
100.000000 0.000000 0.000000 [Lab] -> MatrixFwd -> 24.590359 56.166751
38.068933 [RGB]

The scale is 0 to 100 in the ti3 file and in the xicclu command. For
this profile, G=56.166751. In a perfectly normalized profile it would
be 100.000000, so the target chart is almost one stop underexposed. In
a perfectly color-balanced profile, R and B would be equal to G. The
ti3 file can be modified to make it so:

Multiply the green values by (100/56.166751)=1.7804127.
Multiply the red values by ((100/56.166751) times
Multiply the blue values by ((100/56.166751) times

The red and blue color balance channel multipliers are
(56.166751/24.590359)=2.284 and (56.166751/38.068933)=1.475. When
eye-droppering off the most neutral patches on the target chart, UFRaw
finds 2.290 and 1.464. As the chart is batch-measured and the patches
aren't actually completely neutral, I would tend to trust the ti3
values at least as much as the eye-droppered values.

Add two fake data points to the new ti3:
B 0.00000 0.00000 0.00000 0 0 0 0 0 0
W 96.4200 100.000 82.491 100 100 100 0 0 0

Save the new ti3 as target-nb (for Normalized and color-Balanced) and
make the final profile:
colprof -v -am -D"target-nb-am" -O"target-nb-am.icc" target-nb
xicclu -s100 -fif -pl -ir target-nb-am.icc
100.000000 0.000000 0.000000 [Lab] -> MatrixFwd -> 99.998152 99.998829
99.999801 [RGB]

Which is almost perfectly normalized and color-balanced. The xicclu
graph looks like a single line.

I've been using "-am u" to make the first profile, "-am" to make the
second profile, and "-ir" with xicclu, but maybe other options would
work even better. Color-balancing the raw file during interpolation
doesn't change the procedure. The modified ti3 file can also be used
to make other types of camera profiles, not just "-am".

I've used this procedure with several different camera makes and
models and quite a few different target shots. It seems to work really
well and could even be built in as a colprof option. It would make
life easier for people trying to make their first general purpose
camera profile.

Kind regards,

http://ninedegreesbelow.com - articles on open source digital photography

Other related posts: