ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/cielab.cal
Revision: 1.3
Committed: Mon Feb 20 23:16:31 2017 UTC (7 years, 2 months ago) by greg
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad5R1, rad5R3, HEAD
Changes since 1.2: +6 -4 lines
Error occurred while calculating annotation data.
Log Message:
Updated for linear portion of cube root function

File Contents

# Content
1 { RCSid $Id: cielab.cal,v 1.2 2005/05/25 04:44:25 greg Exp $ }
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 DEL : 6/29;
10 bfunc(x) : if(x - DEL*DEL*DEL, x^(1/3), x/(3*DEL*DEL) + 2/3*DEL);
11 Ls(Yi) : 116*bfunc(Yi/Yw) - 16;
12 as(Xi,Yi,Zi) : 500*(bfunc(Xi/Xw) - bfunc(Yi/Yw));
13 bs(Xi,Yi,Zi) : 200*(bfunc(Yi/Yw) - bfunc(Zi/Zw));
14
15 { CIE 1976 Lab delta E formula }
16 dE76(X1,Y1,Z1,X2,Y2,Z2) : sqrt( sq(Ls(Y1)-Ls(Y2))
17 + sq(as(X1,Y1,Z1)-as(X2,Y2,Z2))
18 + sq(bs(X1,Y1,Z1)-bs(X2,Y2,Z2)) );
19
20 { CIE 1994 Lab delta E formula }
21 kL = 1; kC = 1; kH = 1; { viewing factors }
22 Cs(Xi,Yi,Zi) : sqrt( sq(as(Xi,Yi,Zi)) + sq(bs(Xi,Yi,Zi)) );
23 C1s(X1,Y1,Z1,X2,Y2,Z2) : sqrt(Cs(X1,Y1,Z1)*Cs(X2,Y2,Z2));
24 dHs(X1,Y1,Z1,X2,Y2,Z2) : sqrt( sq(as(X1,Y1,Z1)-as(X2,Y2,Z2))
25 + sq(bs(X1,Y1,Z1)-bs(X2,Y2,Z2))
26 - sq(Cs(X1,Y1,Z1)-Cs(X2,Y2,Z2)) );
27 dE94(X1,Y1,Z1,X2,Y2,Z2) : sqrt( sq((Ls(X1,Y1,Z1)-Ls(X2,Y2,Z2))/kL)
28 + sq( (Cs(X1,Y1,Z1)-Cs(X2,Y2,Z2)) /
29 (kC*(1+.048*C1s(X1,Y1,Z1,X2,Y2,Z2))) )
30 + sq( dHs(X1,Y1,Z1,X2,Y2,Z2) /
31 (kH*(1+.014*C1s(X1,Y1,Z1,X2,Y2,Z2))) ) )