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 colorSpec
computeCRI( x, CCT=NULL, adapt=TRUE, tol=5.4e-3, attach=FALSE )
# S3 method for colorSpec
computeCRIdata( x, CCT=NULL, adapt=TRUE, tol=5.4e-3 )
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. |
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.
a non-empty colorSpec object with type
equal to 'light'
.
The spectra in x
are the test illuminants.
For computeCRIdata()
there must be exactly 1 spectrum.
For computeCRI()
there can be multiple spectra.
the Correlated Color Temperature of the reference illuminant.
If CCT=NULL
(the default) then CCT
is computed from the test illuminant.
The user can override this with a target CCT, e.g. the advertised CCT for a particular light bulb.
For computeCRIdata()
there must be exactly one CCT
.
For computeCRI()
the length of the vector must be either 1 or the number of spectra
in x
.
if TRUE
, then a special chromatic adaption is performed, see Details
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 NA_real_
.
The default tol=5.4e-3
is the one recommended by the CIE,
but the argument allows the user to override it.
To ignore this test, set tol=Inf
.
if TRUE
and there is exactly 1 spectrum in x
,
then the list of intermediate calculations returned by computeCRIdata()
is attached to the returned number, as attribute data
.
This attached list includes data for all 14 color samples,
though only the first 8 are used to compute the CRI. If there is not exactly 1 spectrum in x
,
then attach
is ignored.
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.
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
computeCRI( subset(Fs.5nm,'F2') )
## F2
## 64.15195
computeCRI( subset(Fs.5nm,'F2'), CCT=4200 )
## F2
## 63.96502
computeCRIdata( subset(Fs.5nm,'F2') ) # returns a very large list, ending with CRI = 64.15195
Run the code above in your browser using DataLab