Learn R Programming

colorSpec (version 1.5-0)

computeCCT: Compute Correlated Color Temperature (CCT) of Light Spectra

Description

Compute the CCT, in K, of a colorSpec object with type equal to 'light'

Usage

# S3 method for colorSpec
computeCCT( x, isotherms='robertson', locus='robertson', strict=FALSE )

Value

computeCCT() returns a numeric vector of length M, where M is the number of spectra in x. The vector's names is set to specnames(x).

If the type of x is not 'light', then a warning is issued and all values are NA_real_.

Arguments

x

an colorSpec R object with type equal to 'light', and M spectra

isotherms

A character vector whose elements match one of the available isotherm families: 'robertson', 'mccamy', and 'native'. Matching is partial and case-insensitive. When more than one family is given, a matrix is returned, see Value. When isotherms='native' the isotherms are defined implicitly as lines perpendicular to the locus, see Details in spacesXYZ::CCTfromXYZ(). The character NA (NA_character_) is taken as a synonym for 'native'.

locus

valid values are 'robertson' and 'precision', see above. Matching is partial and case-insensitive.

strict

The CIE considers the CCT of a chromaticity uv to be meaningful only if the distance from uv to the Planckian locus is less than or equal to 0.05 [in CIE UCS 1960]. If strict=FALSE, then this condition is ignored. Otherwise, the distance is computed along the corresponding isotherm, and if it exceeds 0.05 the returned CCT is set to NA.

Details

In computeCCT(), for each spectrum, XYZ is computed using xyz1931.1nm, and the result passed to spacesXYZ::CCTfromXYZ(). If the quantity of x is 'photons' (actinometric) each spectrum is converted to 'energy' (radiometric) on the fly.

References

McCamy, C. S. Correlated color temperature as an explicit function of chromaticity coordinates. Color Research & Application. Volume 17. Issue 2. pages 142-144. April 1992.

Robertson, A. R. Computation of correlated color temperature and distribution temperature. Journal of the Optical Society of America. 58. pp. 1528-1535 (1968).

Wyszecki, Günther and W. S. Stiles. Color Science: Concepts and Methods, Quantitative Data and Formulae, Second Edition. John Wiley & Sons, 1982. Table 1(3.11). pp. 227-228.

See Also

type(), quantity(), xyz1931, planckSpectra(), specnames(), spacesXYZ::CCTfromXYZ()

Examples

Run this code
computeCCT( D65.1nm )                       # returns 6502.068
computeCCT( D65.1nm, isotherms='native' )   # returns 6503.323
computeCCT( A.1nm )                         # returns 2855.656
computeCCT( A.1nm, isotherms='native' )     # returns 2855.662
computeCCT( A.1nm, isotherms='mccamy' )     # returns 2857.188

moon = readSpectra( system.file( "extdata/sources/moonlight.txt", package='colorSpec' ) )
computeCCT( moon )                  # returns 4482.371

Run the code above in your browser using DataLab