ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/cielab.cal
Revision: 1.1
Committed: Sat Feb 22 02:07:21 2003 UTC (21 years, 2 months ago) by greg
Branch: MAIN
CVS Tags: rad3R5, rad3R6, rad3R6P1
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# Content
1 {
2 Compute Lab color space and color differences from XYZ primaries.
3
4 5/25/02 G.Ward
5 }
6 Xw = 1; Yw = 1; Zw = 1; { default white }
7 sq(x) : x*x;
8 Ls(Yi) : if(Yi/Yw - .01, 116*(Yi/Yw)^(1/3) - 16, 903.3*Yi/Yw);
9 as(Xi,Yi,Zi) : 500*((Xi/Xw)^(1/3) - (Yi/Yw)^(1/3));
10 bs(Xi,Yi,Zi) : 200*((Yi/Yw)^(1/3) - (Zi/Zw)^(1/3));
11
12 { CIE 1976 Lab delta E formula }
13 dE76(X1,Y1,Z1,X2,Y2,Z2) : sqrt( sq(Ls(Y1)-Ls(Y2))
14 + sq(as(X1,Y1,Z1)-as(X2,Y2,Z2))
15 + sq(bs(X1,Y1,Z1)-bs(X2,Y2,Z2)) );
16
17 { CIE 1994 Lab delta E formula }
18 kL = 1; kC = 1; kH = 1; { viewing factors }
19 Cs(Xi,Yi,Zi) : sqrt( sq(as(Xi,Yi,Zi)) + sq(bs(Xi,Yi,Zi)) );
20 C1s(X1,Y1,Z1,X2,Y2,Z2) : sqrt(Cs(X1,Y1,Z1)*Cs(X2,Y2,Z2));
21 dHs(X1,Y1,Z1,X2,Y2,Z2) : sqrt( sq(as(X1,Y1,Z1)-as(X2,Y2,Z2))
22 + sq(bs(X1,Y1,Z1)-bs(X2,Y2,Z2))
23 - sq(Cs(X1,Y1,Z1)-Cs(X2,Y2,Z2)) );
24 dE94(X1,Y1,Z1,X2,Y2,Z2) : sqrt( sq((Ls(X1,Y1,Z1)-Ls(X2,Y2,Z2))/kL)
25 + sq( (Cs(X1,Y1,Z1)-Cs(X2,Y2,Z2)) /
26 (kC*(1+.048*C1s(X1,Y1,Z1,X2,Y2,Z2))) )
27 + sq( dHs(X1,Y1,Z1,X2,Y2,Z2) /
28 (kH*(1+.014*C1s(X1,Y1,Z1,X2,Y2,Z2))) ) )