Learn R Programming

spacesXYZ (version 1.0-1)

adaptation: Chromatic Adaptation Transforms (CATs)

Description

Transform from a source viewing enviroment with a given illuminant, to a target viewing environment with a different illuminant. Some standard linear CATs are available.

Usage

CAT( source.XYZ, target.XYZ, method="Bradford" )

Arguments

source.XYZ

the XYZ of the illuminant in the source viewing environment. source.XYZ can also be a string with the name of a standard illuminant as in the function standardXYZ().

target.XYZ

the XYZ of the illuminant in the target viewing environment. target.XYZ can also be a string with the name of a standard illuminant as in the function standardXYZ().

method

the method used for the chromatic adaptation. Available methods are: "Bradford", "VonKries", "MCAT02", and "scaling"; see References. Partial matching is enabled, and matching is case-insensitive.

Value

CAT() returns an object with S3 class CAT, which can be passed to adaptXYZ(), adaptxyY(), adaptLab(), or adaptLuv().

An object with S3 class CAT is a list with the following items:

method

full name of the adaptation method, as in Arguments

Ma

3x3 cone response matrix \(M_A\) for the method, as defined in Lindbloom

source.XYZ

XYZ of the illuminant in the source viewing environment

source.xyY

xyY of the illuminant in the source viewing environment

target.XYZ

XYZ of the illuminant in the target viewing environment

target.xyY

xyY of the illuminant in the target viewing environment

M

3x3 matrix defining the CAT. The matrix is written on the left and the source XYZ is written as a column vector on the right. This matrix depends continuously on source.XYZ and target.XYZ, and when these are equal, M is the identity. Therefore, when source.XYZ and target.XYZ are close, M is close to the identity. Compare with Lindbloom.

Analogy

Chromatic adaptation can be viewed as an Aristotelian analogy of proportions. A general analogy of this type is usually written A:B = C:D and read as "A is to B as C is to D". In our case the expression A:I is read as "the appearance of A in a viewing environment with illuminant I", or more simply "the appearance of A under illuminant I". It is better to think of A not as an object color, but as a self-luminous color. The analogy \(A:I = B:J\) can be read as "the appearance of \(A\) under illuminant \(I\) is the same as the appearance of \(B\) under illuminant \(J\)".

Solving this problem of chromatic adaptation is solving this analogy for X: A:I = X:J, where I is the the source illuminant and J is the target illuminant.

References

Hunt, R. W. G. The Reproduction of Colour. 6th Edition. John Wiley & Sons. 2004.

International Color Consortium. ICC.1:2001-04. File Format for Color Profiles. 2001.

Lindbloom, Bruce. Chromatic Adaptation. http://brucelindbloom.com/Eqn_ChromAdapt.html

Pascale, Danny. A Review of RGB Color Spaces ...from xyY to R'G'B'. http://www.babelcolor.com/download/A%20review%20of%20RGB%20color%20spaces.pdf. 2003.

Wikipedia. CIECAM02. https://en.wikipedia.org/wiki/CIECAM02

See Also

standardXYZ()

Examples

Run this code
# NOT RUN {
D65toC = CAT( 'D65', 'C' )
D65toC

##  $method
##  [1] "Bradford"
##  
##  $Ma
##          X       Y       Z
##  L  0.8951  0.2664 -0.1614
##  M -0.7502  1.7135  0.0367
##  S  0.0389 -0.0685  1.0296
##  
##  $source.XYZ
##            X Y       Z
##  D65 0.95047 1 1.08883
##  
##  $source.xyY
##              x         y Y
##  D65 0.3127266 0.3290231 1
##  
##  $target.XYZ
##          X Y       Z
##  C 0.98074 1 1.18232
##  
##  $target.xyY
##            x         y Y
##  C 0.3100605 0.3161496 1
##  
##  $M
##              X            Y           Z
##  X 1.009778519  0.007041913 0.012797129
##  Y 0.012311347  0.984709398 0.003296232
##  Z 0.003828375 -0.007233061 1.089163878
##  
##  attr(,"class")
##  [1] "CAT"  "list"


adaptXYZ( D65toC, c(1,1,0.5) )
##              X         Y         Z
##  [1,] 1.023219 0.9986689 0.5411773
# }

Run the code above in your browser using DataLab