ColorFnsDoc.tioga
Maureen Stone, December 9, 1986 6:14:08 pm PST
COLORFNS
CEDAR 6.1 — FOR INTERNAL XEROX USE ONLY
ColorFns
Maureen Stone
© Copyright 1986 Xerox Corporation. All rights reserved.
Abstract: This is a collection of standard color functions. The CIE tristimulus values, X,Y,Z and chromaticity values, x,y, are defined as data types in the the ImagerColor interface. This package provides a way to convert these value to other CIE defined systems, including lightness, metric chromaticity and color differences, (CIELAB, CIELUV). Also included are routines for computing some functions used in the graphic arts industry: Density, Reflectance and Dot Area.
Created by: Maureen Stone
Maintained by: Maureen Stone <Stone.pa>
Keywords: color, density, dot area
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
1. CIE Color Functions
The CIE tristimulus values, X,Y,Z and chromaticity values, x,y, are defined as data types in the the ImagerColor interface. This package provides a way to convert these value to other CIE defined systems.
The CIE lightness function, L* = F[Y], is a fairly close match for the Munsel Value function for luminance > 1%. There is a formula for luminance < 1%, but its use is somewhat controversial. Note that such colors are quite dark. The lightness is not an absolute function, but is defined relative to a standard white.
LStarFromLuminance: PROC [Y: REAL, whiteY: REAL] RETURNS[lStar: REAL];
L* = 116(Y/Yn)1/3 - 16 Y/Yn > 0.008856
L* = 903.29(Y/Yn) Y/Yn <= 0.008856
LuminanceFromLStar: PROC [lStar: REAL, whiteY: REAL] RETURNS[Y: REAL];
The CIE chromaticity diagram is not perceptually very uniform. That is, distances in the diagram do not corespond to perceptual difference. For example, a two blue colors that look similar will be closer together on the diagram than two green colors that look similar by the same amount. The Metric Chromaticity diagram is a transformation of the chromaticity diagram that is supposed to be more uniform. The metric chromaticity can be computed from either the tristimulus values or the chromaticity values.
MetricChrFromChr: PROC[xy: CIEChromaticity] RETURNS[uv: MetricChromaticity];
u' = 4x/(-2x+12y+3) v' = 9y/(-2x+12y+3)
ChrFromMetricChr: PROC[uv: MetricChromaticity] RETURNS[xy: CIEChromaticity];
x = 27u'/(18u'-48v'+36)  y = 12v'/(18u'-48v'+36)
MetricChrFromXYZ: PROC[xyz: CIE] RETURNS[uv: MetricChromaticity];
u' = 4X/(X+15Y+3Z) v' = 9Y/(X+15Y+3Z)
The inverse function, XYZFromMetricChr, does not seem to be commonly used. That is, I don't know what additional information (Y? L? L*?) typically goes with u',v' to convert back to XYZ
In 1976, the CIE standardized two systems for measuring color difference. Both were based on existing systems, both were judged to work equally well, and neither are perfect. The CIELAB system was derived from the ANLAB system, which was in common use for colorants in paints, plastic and textiles. CIELUV is related to the metric chromaticity diagram (and I'm not sure what else).
CIELABFromXYZ: PROC [xyz: CIE, white: CIE] RETURNS[lab: CIELAB];
XYZFromCIELAB: PROC [lab: CIELAB, white: CIE] RETURNS[xyz: CIE];
The equations for CIELAB are:
a* = 500[(X/Xn)1/3 - (Y/Yn)1/3]
b* = 200[(Z/Zn)1/3 - (Y/Yn)1/3]
where Xn, Yn, Zn are the tristimulus values of the reference white. For values of X/Xn, Y/Yn, or Z/Zn less than 0.008856 use ??
CIELUVFromXYZ: PROC [xyz: CIE, white: CIE] RETURNS[luv: CIELUV];
XYZFromCIELUV: PROC [luv: CIELUV, white: CIE] RETURNS[xyz: CIE];
The equations for CIELUV are:
u* = 13L*(u'-un')
v* = 13L*(v'-vn')
where u' and un' are the Metric Chromaticiy coordinates of the value and the reference white
In CIELAB or CIELUV, the perceptual difference between two colors is approximately the euclidian distance between the two points in the color space. One unit equals a "noticeable" color difference. Both use the same function for lightness, L*, defined above, with the same caveat for very dark colors. Both are defined relative to a "reference white". These formulas are intended for colors that are close to one another. Don't get too hung up on the numbers here—some sources claim that only one digit is significan.
DifferenceCIELAB: PROC [color1, color2: CIELAB] RETURNS [difference: REAL];
DifferenceCIELUV: PROC [color1, color2: CIELUV] RETURNS [difference: REAL];
2. Density and Dot Area
Density is a logrithmic measurement of reflectance, R, or transmittance, T=1-R commonly used in the graphic arts industry.
DensityFromReflectance: PROC[r: REAL] RETURNS[REAL];
d ← Log[1/R]. Reflectance of 0 will return a density of 5.0 (R=0.00001)
Reflectance is percentage [0+..100].
ReflectanceFromDensity: PROC[d: REAL] RETURNS[REAL];
Density is positive. To be consistant with procedure above, Density in [0..3]
Dot area is the percentage area covered by a halftone pattern. For example, a pattern that covers 3/4 of the area with ink has a dot area of 75%. Ideally, dot area is related to density by density=dot area/100. This is only true for film transmittance, however. For printed pages, density is related to dot area by a more complicated formula which accounts for the scattering of light around the dots and the surface properties of the paper.
DensityFromDotArea: PROC[area: REAL, solidD: REAL ← 1.5, n: REAL ← 1.4] RETURNS[density: REAL];
area is percentage in [0..100], Density is positive. D = -n*log[1-a(1-10-solidD/n)]
If n=1 then reduces to the Murray-Davis equations (ref. Yule).
DotAreaFromDensity: PROC[density: REAL, solidD: REAL ← 1.5, n: REAL ← 1.4] RETURNS[area: REAL];
area is percentage in [0..100], Density is positive. Inverse of above