Index of /homepages/aspirin/cpercep
Name Last modified Size Description
Parent Directory 05-Oct-2008 05:57 -
cpercep.README 08-Jan-2003 15:40 1k
cpercep.c 08-Jan-2003 15:37 14k
cpercep.c: The CPercep Functions v0.9: 2002-02-10
Adam D. Moss: adam@gimp.org <http://www.foxbox.org/adam/code/cpercep/>
This code module concerns itself with conversion from a hard-coded
RGB colour space (sRGB by default) to CIE L*a*b* and back again with
(primarily) precision and (secondarily) speed, oriented largely
towards the purposes of quantifying the PERCEPTUAL difference between
two arbitrary RGB colours with a minimum of fuss.
Motivation One: The author is disheartened at the amount of graphics
processing software around which uses weighted or non-weighted
Euclidean distance between co-ordinates within a (poorly-defined) RGB
space as the basis of what should really be an estimate of perceptual
difference to the human eye. Certainly it's fast to do it that way,
but please think carefully about whether your particular application
should be tolerating sloppy results for the sake of real-time response.
Motivation Two: Lack of tested, re-usable and free code available
for this purpose. The difficulty in finding something similar to
CPercep with a free license motivated this project; I hope that this
code also serves to illustrate how to perform the
R'G'B'->XYZ->L*a*b*->XYZ->R'G'B' transformation correctly since I
was distressed to note how many of the equations and code snippets
on the net were omitting the reverse transform and/or were using
incorrectly-derived or just plain wrong constants.
TODO: document functions, rename erroneously-named arguments