Convert wavelength in nm into an RGB value set.
Given a N-dimensional matrix wavelength with color values in nm, returns a RGB image with N+3 dimensions.
wavelength2rgb (400)
⇒ [0.51222 0.00000 0.70849]
wavelength2rgb ([400 410])
⇒ 0.51222 0.49242
⇒ 0 0
⇒ 0.70849 0.85736
The rgb class can be specified with class. Possible values are double (default), single, uint8, uint16, and int16.
wavelength2rgb (400)
⇒ 0.51222 0.00000 0.70849
wavelength2rgb (400, "uint8")
⇒ 131 0 181
The luminance of colors can be adjusted with gamma which must a scalar value in the range [0 1]. Defaults to 0.8.
Reference:
The following code
##draw RGB values for wavelengths between 350 and 800 nm RGB = wavelength2rgb (350:800); rgbplot (squeeze (RGB), "composite"); axis off;
Produces the following figure
| Figure 1 |
|---|
![]() |
Package: image