Calculates rgb values from spectra based on human color matching functions.

spec2rgb(rspecdata, alpha = 1)

Arguments

rspecdata

(required) a data frame, possibly an object of class rspec, with a column with wavelength data, named 'wl', and the remaining column containing spectra to process.

alpha

alpha value to use for colors (defaults to 1, opaque).

Value

A character vector of class spec2rgb consisting of hexadecimal color values for passing to further plotting functions.

References

CIE(1932). Commission Internationale de l'Eclairage Proceedings, 1931. Cambridge: Cambridge University Press.

Color matching functions obtained from Colour and Vision Research Laboratory online data repository at http://www.cvrl.org/. http://www.cs.rit.edu/~ncs/color/t_spectr.html.

Examples

# NOT RUN {
data(teal)
spec2rgb(teal)

# Plot data using estimated perceived color
plot(teal, col = spec2rgb(teal), type = 'o')
# }