[argyllcms] Re: Profiling between two images

  • From: Klaus Karcher <lists@xxxxxxxxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Sat, 31 Jan 2009 13:16:34 +0100

Pascal de Bruijn wrote:
I've more or less asked about this in the past, but I gave up on it,
back then...

I have two images of an IT8 chart...

1. A digital camera generated JPG (white-balanced, and gamma corrected)
2. A RAW file, converted to JPG (white-balanced, but not gamma
corrected, so it's linear RGB)

Both images, are in fact, the same image, just stored in a different way...

I'd like to generate a profile, which would turn my nr 2 image into
something very close to my nr 1 image.

Is this possible? Can anybody help me with accomplishing this?

Ok, I think finally I got what you try to achieve: your "image 1" is no faithful reproduction, but you like the "look" you get when using workflow 1 and want to obtain the same biased result with workflow 2.

Provided that the workflows are deterministic, you can create a profile for workflow 2 that largely replicates the "look" (or errors from a colorimetric point of view) of workflow 1.

What you need is a profile built from a "faked" ti3 file. This file has to link the device values of image 2 with cie values calculated from image 1 with profile 1.

There are several ways to achieve this. I want to outline one of them using scanin and fakeread.

Klaus
# image1.tif and image2.tif are images of a ColorCheckerSG  
# processed with workflow 1 and workflow 2

# read the device values from image1:
scanin -dipn image1.tif ColorCheckerSG.cht ColorCheckerSG.cie diag.tif
# image1.ti3 contains device values from image 1 
# and cie values from ColorCheckerSG.cie
# the cie values in ColorCheckerSG.cie are trivial 
# as we replace them later anyway

# create ti1 for fakeread
cp image1.ti3 fake.ti1
# change line 1 of file fake.ti1 from "CTI3" to "CTI1" and
# line 9 from 
# COLOR_REP "XYZ_RGB" 
# to
# COLOR_REP "RGB"

# create ti2 for fakeread
cp fake.ti1 fake.ti2

# change line 1 of file fake.ti2 from 
# CTI1 
# to 
# CTI2

# add column "SAMPLE_LOC" to file fake.ti2 
# (contents depends on your cht file) 
# example for ColorCheckerSG:

# before:
# ...
# NUMBER_OF_FIELDS 10
# BEGIN_DATA_FORMAT
# SAMPLE_ID XYZ_X XYZ_Y XYZ_Z RGB_R RGB_G RGB_B STDEV_R STDEV_G STDEV_B 
# END_DATA_FORMAT
# 
# NUMBER_OF_SETS 140
# BEGIN_DATA
# A01 89.130 92.990 75.770 98.873 99.556 99.984 0.23857 0.15282 0.19374 
# A02 0.80000 0.84000 0.70000 7.3287 6.6960 7.3602 1.3017 1.3735 1.2807 
# A03 18.560 19.270 15.790 44.461 48.695 55.216 0.41040 0.28607 0.27125 
# ...

# after:
# ...
# KEYWORD "SAMPLE_LOC"
# NUMBER_OF_FIELDS 11
# BEGIN_DATA_FORMAT
# SAMPLE_ID SAMPLE_LOC XYZ_X XYZ_Y XYZ_Z RGB_R RGB_G RGB_B STDEV_R STDEV_G 
STDEV_B 
# END_DATA_FORMAT
# 
# NUMBER_OF_SETS 140
# BEGIN_DATA
# A01 A1 89.130 92.990 75.770 98.873 99.556 99.984 0.23857 0.15282 0.19374 
# A02 A2 0.80000 0.84000 0.70000 7.3287 6.6960 7.3602 1.3017 1.3735 1.2807 
# A03 A3 18.560 19.270 15.790 44.461 48.695 55.216 0.41040 0.28607 0.27125 
# ...

# use fakeread to read the cie values for image 1 as "seen" by profile1
fakeread profile1.icc fake
# fake.ti3 now contains device values from image 1 
# and corresponding cie values calculated with profile1.icc

# use scanin to replace device values in fake.ti3 
# with device values from image2
scanin -r -dipn image2.tif ColorCheckerSG.cht fake diag.tif

# modify file fake.ti3
# change DEVICE_CLASS "DISPLAY"
# to     DEVICE_CLASS "INPUT"
# and COLOR_REP "RGB_XYZ"
# to  COLOR_REP "XYZ_RGB"

# create your fake profile
colprof fake

# when you assing fake.icc to image2.tif, 
# it shold look largely like image1 with profile1

Other related posts: