View source: R/colorSpec.CRI.R
computeCRI | R Documentation |
Compute the CIE 1974 color rendering index (CRI) of a light spectrum,
called the the test illuminant.
From the given spectrum a reference illuminant is selected with the same CCT
(Correlated Color Temperature).
A selected set of 8 color samples is rendered in XYZ (1931) with both illuminants
and 8 color differences are computed in CIE 1964 UVW color space.
For each color sample a CRI is computed, where 100 is a perfect color match.
The final CRI is the average of these 8 CRI values.
## S3 method for class 'colorSpec'
computeCRI( x, CCT=NULL, adapt=TRUE, tol=5.4e-3, attach=FALSE )
## S3 method for class 'colorSpec'
computeCRIdata( x, CCT=NULL, adapt=TRUE, tol=5.4e-3 )
x |
a non-empty colorSpec object with |
CCT |
the Correlated Color Temperature of the reference illuminant.
If |
adapt |
if |
tol |
for the CRI to be meaningful the chromaticities of the test and reference illuminants must be sufficiently close in the CIE
1960 uniform chromaticity space.
If the tolerance is exceeded, the CRI is set to |
attach |
if |
If not NULL
, the CCT of x
is computed by computeCCT()
with default options.
When computing XYZs, the wavelengths of x
and the color matching functions
of xyz1931.1nm
are used.
If adapt
is TRUE
the 8 color sample uv
points
are chromatically adapted from the test illuminant to the reference illuminant
using a special von Kries type transformation; see Oleari and
Wikipedia.
The color sample UVW values are computed with the reference illuminant.
If adapt
is FALSE
the 8 color sample uv
points
are not chromatically adapted,
and the color sample UVW values are computed with the test illuminant.
computeCRI()
returns a vector of CRI values with length equal to the
number of spectra in x
. All values are \le
100.
In case of ERROR the CRI value is NA_real_
.
If attach
is TRUE
and x
has exactly one spectrum,
a large list of intermediate calculations is attached to the returned number.
computeCRIdata()
returns a list of intermediate calculations,
for the single spectrum in x
.
The items in the list are:
CCT | the Correlated Color Temperature of the reference illuminant. |
illum.ref | the reference illuminant, which is a colorSpec object. |
table1 | a data frame with 2 rows, with CIE data for the test and reference illuminants (see below). |
Delta_uv | the distance between the illuminants in the CIE 1960 uniform chromaticity space. |
table2 | a data frame with 14 rows, with CIE XYZ data of the 14 color samples. |
table3 | a data frame with 14 rows, with CIE uv data of the 14 color samples. If argument adapt is FALSE , then table3=NULL . |
table4 | a data frame with 14 rows, with UVW data of the 14 color samples, including the CRI of each sample. |
The columns of table1
are:
XYZ | the CIE XYZ of the 2 illuminants. |
xy | the CIE xy of the 2 illuminants. |
uv | the CIE 1960 uv of the 2 illuminants. Delta_uv is the distance between these 2 points. |
The first row of table1
is the given test illuminant, and the second row is the reference illuminant.
The initial letter of the rowname of the reference indicates the type:
the letter P
means a Planckian illuminant, and the letter D
means a Daylight illuminant.
The columns of table2
are:
referen | the CIE XYZ of the color sample, as illuminated by the reference illuminant. |
test | the CIE XYZ of the color sample, as illuminated by the test illuminant. |
The columns of table3
are:
before | the CIE 1960 uv of the color sample, as illuminated by the test illuminant. |
after | the before values, after adaptation to the reference illuminant. |
difference | after - before |
The columns of table4
are:
referen | the UVW of the color sample, as illuminated by the reference illuminant. |
test | the UVW of the color sample, as illuminated by the test illuminant. |
DeltaE | the distance between the test and reference UVWs |
CRI | the CRI of the color sample, which is a function of DeltaE . |
The final CRI is the average of the CRI
of the first 8 samples in table4
,
and the remaining samples are ignored.
The reflectance spectra of the 14 color samples are taken from:
http://www.lrc.rpi.edu/programs/nlpip/lightinganswers/lightsources/scripts/NLPIP_LightSourceColor_Script.m
The wavelength vector is 360nm to 830nm with 5nm step. The same data over 380nm to 780nm is in Appendix 7 of Hunt and Pointer.
Oleari, Claudio, Gabriele Simone. Standard Colorimetry: Definitions, Algorithms and Software. John Wiley. 2016. pp. 465-470.
Günther Wyszecki and W. S. Stiles. Color Science: Concepts and Methods, Quantitative Data and Formulae, Second Edition. John Wiley & Sons, 1982. Table 1(3.11). p. 828.
Wikipedia. Color rendering index. https://en.wikipedia.org/wiki/Color_rendering_index
Hunt, R. W. G. and M. R. Pointer. Measuring Colour. 4th edition. John Wiley & Sons. 2011. Appendix 7.
type()
,
xyz1931
,
computeCCT()
computeCRI( Fs.5nm )
## F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12
## 75.82257 64.15195 56.68144 51.36348 NA NA 90.18452 95.50431 90.29347 81.03585 82.83362 83.06373
computeCRI( Fs.5nm, adapt=FALSE )
## F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12
## 77.73867 65.38567 57.20553 50.65979 NA NA 90.18551 95.96459 90.27063 82.86106 82.86306 83.10613
F2 = subset(Fs.5nm,'F2')
computeCRI( F2 )
## F2
## 64.15195
computeCRI( F2, CCT=4200 )
## F2
## 63.96502
computeCRIdata( F2 ) # returns a very large list, ending with CRI = 64.15195
mean( computeCRIdata( F2 )$table4$CRI[1:8] ) == computeCRI( F2 )
## F2
## TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.