Proposal for Monitor Profiling
From Scribus Public Wiki
| Installation • Usage • PDF issues • DTP • Other |
Proposal for a monitor-calibration using linux, updated version
1 Preface:
Using gimp, cinepaint and scribus we can benefit from color-calibration for the digital image workflow. But there is still a main feature missing. As far as I know, no hardware-manufacturer is providing a linux-software for the screen-calibration instruments (usually called “spiders” ...). Due to that fact, an alternative way has to be investigated for measuring and calculation of the screen-profiles.
2 Basic Idea:
Modern digital cameras offer a mean to read out high quality RGB-values using the raw camera data. Therefore it may be feasible to use such a camera as measurement instrument by:
- getting the monitor in a more or less controlled state near a standard colour space just like sRGB by adjusting the colour temperature, the brightness, contrast and the gamma using xgamma (look also for tkgamma)
- calibration the digital camera using a camera target
- shooting a screen-image with the digital kamera, using this image as measurement data for calculating of a monitor-profile by:
- either using the measurement data to build a profile directly or
- using only the some significant data (gamma, white-point and primaries) to build a coarse profile which is based on measurements and not on visual estimations only.
3 How to do it:
3.1 Getting the Monitor to a controlled state:
This is only done to minimize the transformations, which must be done with the color-management-system. If you come closer to standard sRGB, you will in addition achieve a better display for non-managed applications. We should select a colour-temperature of 6.500 K for sRGB. This can sometimes be done by selecting it on the monitor-menu. If that is not possible, I would suggest to select the "warm" colour on the monitor. Then adjust the contrast, brightness and gamma just like described within the software tkgamma.
Alternatively print business likes to have a color-temperature of 5.000 K which is quite near to 5.500 K. Print likes a gamma of 1.8 (this will correspond well with the rendering of greyscales with half-tone printing). To help to get your monitor close to 5.500 K I tried the following (see also http://de.wikipedia.org/wiki/Farbtemperatur or http://en.wikipedia.org/wiki/Color_temperature for color temperatures):
- (1) shoot an image of a white board (for example the white back of a grey card) under flashlight conditions, which should be near 5.500 K, the camera may be in sRGB mode
- (2) look at the values of RGB (use the pipette tool in gimp)
- (3) then shoot a screen photo with the camera
- (4) and compare the RGB values of the white board with the screen image then alter the monitor-setting and repeat from (3) until the RGB-relations from the screen photo are approx. the same then in the photo of the white board.
3.2 Calibration and other software:
Well, I used a lot, namely:
- VUESCAN (prof. version, [1])to produce a screen target
- gimp and cinepaint to display an handle images
- dcraw and netpbm to import camera raw-files
- lcms as colour-management libraries and the icctrans tool to calculate colors.
- lprof for for profile creation
- awk to do some text manipulation
- a text editor and
- OpenOfficeOrg to put the screen-target RGB-Values together with the measurement
Within the open software community color-management is done mostly by lcms (http://www.littlecms.com or http://www.lcms.coloraid.de). We will need that to do the calibrations (program icctrans). The profiling will be done by lprof, a graphical profiler (http://sourceforge.net/projects/lprof). Furthermore we need dcraw to do the raw conversions and cinepaint to work with 16-bit images.
3.3 Calibrating the camera:
Probably a good camera is needed, which is able to store the raw-data. Change to the raw-data mode and use lowest ISO. The camera used was a Canon EOS 300d.
We need a colour-target (look for Wolf Faust for cheap ones, http://www.coloraid.de). Then shoot the target (I expose using automatic exposure control, close the aperture to avoid vignetting).
Then shoot the target with the camera in raw-mode. Be careful, to avoid reflections and try to find a controlled lighting situation (shadows are too cold!). I prefer to use bounced flashes.
To check the accurate colors, try following: Shoot a white board (for examples the rear side of a grey-card) in sRGB-Mode and measure the results in gimp or cinepaint (pipette tool). White should show up as RED=GREEN=BLUE. Any difference may be corrected after importing the raw-file by multiplying single channels.
The raw file can be imported by:
dcraw -c -4 [raw-file] | pnmtopng -truecolor > [raw-file].png
I then used cinepaint to correct a colour-error (see above, when RED<>GREEN<>BLUES for pure white, do this by using the colour/levels for the colour-channels) and to blur a little bit to fight against sensor noise.
Then load the image into lprof camera/scanner and make a scanner-profile. I assume hopefully, that I have "controlled standard photographic daylight (d55)" when shooting the color target. Therefore I build the profile using an it8 measuring-sheet with the color values d55 (you can read this sheets with any text-editor an find some information in the sheet about the color value).
3.4 The monitor profile
At that time we have a calibrated measurement tool, the digital camera.
Now there is a need to get a colour target to the monitor. Vuescan lets you make a colour target. Choose make a target, produce a post-script file of this target and convert this post-script file to a png-file using the gimp. I will reference to this file furthermore as “screen-target”.
The monitor-calibration process with lprof needs a measurement-sheet in the style of:
LCMS/MEASUREMENT ORIGINATOR "LPROF-vuescan-built-target.png" MANUFACTURER "LPROF" NUMBER_OF_SETS "288" NUMBER_OF_FIELDS "7" BEGIN_DATA_FORMAT SAMPLE_ID RGB_R RGB_G RGB_B XYZ_X XYZ_Y XYZ_Z END_DATA_FORMAT BEGIN_DATA A1 64 40 40 7.3578 6.0547 3.4729 A2 80 32 32 9.7290 6.7047 2.9205 A3 88 16 32 10.8826 6.6620 2.8687 A4 104 0 24 13.1561 7.7881 2.4414 ....and more lines............................ END_DATA
First of all, you can produce your RGB_R, RGB_G and RGB_B values. This is done by starting lprof and producing a pseudo-profile of the screen-target by:
- choose make a scanner/printer profile
- take a silly name for this non-sense profile
- choose an it8-target covering all fields, only needed to define the measurement-grid
- loading the screen-target image
- and producing the non-sense profile.
You will find the measurement in the .lprof/temp directory (a file named meaurement.cgt). Copy it somewhere. I will call it the screen-target-template.
Then you will have to display the screen target on the screen and shoot it with your camera. Be careful to close the aperture to prevent vignetting and look at the monitor in a way, you would look when working (flat-panels change with view-angle!). I expose in automatic mode a little bit out of focus.
The resulting raw-file is converted with dcraw to a png-file (see above).
Now you have to measure the screen-shot by loading it into lprof and doing it the same was a with the screen-target (see above). This results in a measurement-file with R/G/B values of the screen in the colour-space of the digital camera. This color-space is defined by the camera-profile. Using icctrans from lcms R/G/B values can be transformed between colour-spaces using profiles. In our case we want to calculate the xyz-values, which are needed by lprof. For individual R/G/B values this can be done by:
icctrans -t 1 -c 3 -i [camera-profile] -o "*xyz"
In our case we have a measurement from lprof. For this file-format a script may help you, to do the caculation (ok, I am a bad coder, feel free to find bugs):
#! /bin/sh
if ls $1; then
line_in=nix
until [ "$line_in" = "BEGIN_DATA" ];
do
read line_in
echo
done
read line_in
until [ "$line_in" = "END_DATA" ];
do
#echo First data-set: $line_in;
echo $line_in |awk '{ print $2" "$3" "$4" q"}' | \
icctrans -t 1 -c 3 -i $1 -o "*xyz" |\
awk '{print gensub("X=", "", g,$1)" \"gensub("Y=", "", g,$2" "gensub("Z=", "", g,$3))}'
read line_in
done
else
echo ERROR: Input Profile not found or not given!
echo usage:
echo "convert_to_xyz [input-profile] <rgb_data-file_in_the_style_of_it8-measurement-sheet.cgt >data-file_in_the_style_of_it8-measurement-sheet.xyz "
fi
Use this script by:
[name of your script] [name of the camera-profile] <measurement-data.cgt >measurement-data.xyz
Now you have a screen-target-template and the measurement, it is up to you to combine this two files into one input-file for lprof (i will call it the screen.it8) , each R/G/B data-row of the screen-target-template needs the according X/Y/Z values.
Start lprof again and go to the Monitor-Profiler. Choose there “I want to build an accurate profile from measurement-sheet” and input your screen.it8, enter a profile name and make the profile (it is good to input some text into the profile identification and to use the verbose, store everything to keep a lot of information in the profile).
Now you have a screen-profile, built by lprof and based only on the measurement data.
My experiment showed, that this profile gave some results as monitor-profile, but failed to work properly in very dark areas (below 10 % brigthness). There a lot of colour cast etc. occurred. Therefore this profile was not very satisfying. I think, the reason is, that the sensor of the digital camera produces still a lot of noise in the dark areas, which brings a lot of trouble.
Therefore I had to look for a work-around by using only some data, which will not be biased that strong an give still a lot of information to build a profile. I looked for a way to derive measurement data needed to use the “build a coarse profile” with lprof, which is normally a only human-visual process.
Analysing the resulting profile from above with the lprof profile-checker gave me that data (hint: the profile checker delivers with the lprof version 1.11 crashed, I had to use an old one from 1.09, the standalone qtprofilechecker). I used the gamma, white-point and the primaries calculated with the profile as input for lprof to build a course profile without measurement. Well, that works now quite fine.
This method was tested with two monitors, one cheap no-name TFT panel and a notebook. The TFT was much better concerning the influence of the angle of view and the notebook was worse concerning that, but both gave good results after profiling.
PS.:A lot of work, well I would have never tried this way in the case I could buy a spider-software for linux and maybe I am fully wrong. Hopefully either a colorimeter-producer will support linux or the lprof-project may do it or adopt the process described above.

