R: Spectral irradiance to rgb color conversion

s_e_irrad2rgb {photobiology} | R Documentation

## Spectral irradiance to rgb color conversion

### Description

Calculates rgb values from spectra based on human color matching functions (CMF) or chromaticity coordinates (CC). A CMF takes into account luminous sensitivity, while a CC only the color hue. This function, in contrast to that in package pavo does not normalize the values to equal luminosity, so using a CMF as input gives the expected result. Another difference is that it allows the user to choose the chromaticity data to be used. The data used by default is different, and it corresponds to the whole range of CIE standard, rather than the reduced range 400 nm to 700 nm. The wavelength limits are not hard coded, so the function could be used to simulate vision in other organisms as long as pseudo CMF or CC data are available for the simulation.

### Usage

    s_e_irrad2rgb(w.length, s.e.irrad, sens = photobiology::ciexyzCMF2.spct,
      color.name = NULL, check = TRUE)

### Arguments

`w.length` | numeric vector of wavelengths (nm).
`s.e.irrad` | numeric vector of spectral irradiance values.
`sens` | a chroma_spct object with variables w.length, x, y, and z, giving the CC or CMF definition (default is the proposed human CMF according to CIE 2006.).
`color.name` | character string for naming the rgb color definition.
`check` | logical indicating whether to check or not spectral data.

### Value

A color defined using `rgb`. The numeric values of the RGB components can be obtained using function `col2rgb`.

### Note

Very heavily modified from Chad Eliason's cme16@zips.uakron.edu spec2rgb function in package `Pavo`.

### 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/.

### See Also

Other low-level functions operating on numeric vectors.: `as_energy`, `as_quantum_mol`, `calc_multipliers`, `div_spectra`, `energy_irradiance`, `energy_ratio`, `insert_hinges`, `integrate_xy`, `interpolate_spectrum`, `irradiance`, `l_insert_hinges`, `oper_spectra`, `photon_irradiance`, `photon_ratio`, `photons_energy_ratio`, `prod_spectra`, `split_energy_irradiance`, `split_photon_irradiance`, `subt_spectra`, `sum_spectra`, `trim_tails`, `v_insert_hinges`

### Examples

    my.color <-
        with(sun.data, s_e_irrad2rgb(w.length, s.e.irrad, color.name="sunWhite"))
    col2rgb(my.color)

[Package photobiology version 0.9.21 Index]