Learn R Programming

pavo (version 1.0.0)

spec2rgb: Spectrum to rgb color conversion

Description

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

Usage

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 respository at http://www.cvrl.org/.

http://www.cs.rit.edu/~ncs/color/t_spectr.html.

Examples

Run this code
## Not run: 
# data(teal)
# spec2rgb(teal)
# 
# # Plot data using estimated perceived color
# plot(teal, col = spec2rgb(teal), type = 'o')## End(Not run)

Run the code above in your browser using DataLab