[argyllcms] Re: Using two cameras to create a (pseudo) profile

  • From: Iliah Borg <ib@xxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Sun, 15 Jul 2012 13:17:42 -0400

On Jul 14, 2012, at 4:03 AM, Bernhard Bablok wrote:

> I have read in the
> documentation that scanin has an -o option which will only output the
> values.


As per your suggestion, here is a script that does not use cie

#!/bin/bash

#set camera manufacturer
manufacturer=$1

#set camera model
model=$2

# you may want to set reference converter name & conversion mode here
# for example DPP Vivid
description=$3

# name of the output from the "unprofiled" converter
# no extension, .tif will be added in the script
raw=$4

# name of the output from the reference converter
# no extension, .tif will be added in the script
converted=$5

your_name=$6

# echo $manufacturer, $model, $description, $raw.tif, $converted.tif, $your_name

# automatic pattern recognition for the demosaicked and gamma-adjusted raw file
# input RGB values are in raw.val
scanin -o -v -p -a -G 2.2 -dipn $raw.tif ColorCheckerSG.cht $raw.diag.tif
 
# extract working profile from the reference converter output
extracticc -v $converted.tif $converted.icm

# automatic pattern recognition for the reference conversion
# output RGB values are in converted.val
scanin -o -v -p -a -G 2.2 -dipn $converted.tif ColorCheckerSG.cht 
$converted.diag.tif

# get RGB values from converted.val
# convert them to Lab through converted.icm
# the resulting Lab values are in converted.Lab.val
# one may want to use XYZ instead of Lab
echo "IT8.7/2
ORIGINATOR \"$your_name, $(date +%Y)\"
DESCRIPTOR \"Lab  values obtained from the reference converter $3\"
CREATED  \"$(date)\"
MANUFACTURER \"X-Rite/Gretag Macbeth\"

NUMBER_OF_FIELDS 4
BEGIN_DATA_FORMAT
SAMPLE_ID LAB_L LAB_A LAB_B
END_DATA_FORMAT

NUMBER_OF_SETS 140
BEGIN_DATA" > $converted.Lab.val
awk '/BEGIN_DATA$/ {
                        for(i=1; i<=140; i++) {
                                getline; print $2/255, $3/255, $4/255;
                        }
}' $converted.val |\
xicclu -v0 -ff -ip -pl $converted.icm |\
nl -nln |\
awk ' {l=sprintf ("%c", ($1-1)%14+65); print l int(($1-($1-1)%14)/14)+1, $2, 
$3, $4}' >> $converted.Lab.val
echo "END_DATA" >> $converted.Lab.val

# compose the final ti3, matching input RGB to output Lab
txt2ti3 -v -i $raw.val $converted.Lab.val $raw.rgb2lab

# calculate profile,check the parameters,  -Zp might be the wrong choice
colprof -v -A "$manufacturer" -M "$model" -D "$manufacturer $model 
$description" -C "Copyright $your_name, $(date +%Y)" -Zp -qh -bn -O 
"${manufacturer// /_}_${model// //_}_${description// /_}.icc" $raw.rgb2lab


--
Iliah Borg
ib@xxxxxxxxxxx




Other related posts: