ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/cielab.cal
Revision: 1.2
Committed: Wed May 25 04:44:25 2005 UTC (18 years, 11 months ago) by greg
Branch: MAIN
CVS Tags: rad4R2P2, rad5R0, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R8, rad3R9, rad4R2P1
Changes since 1.1: +1 -0 lines
Log Message:
Created rtcontrib program for computing ray contributions and coefficients

File Contents

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