colour.recovery.RGB_to_msds_Gaussian#

colour.recovery.RGB_to_msds_Gaussian(RGB: ArrayLike, *, as_array: Literal[False] = False) MultiSpectralDistributions[source]#
colour.recovery.RGB_to_msds_Gaussian(RGB: ArrayLike, *, as_array: Literal[True]) NDArrayFloat

Recover the multi-spectral distributions from the specified RGB colourspace array using Gaussian basis spectra and the Smits (1999) decomposition algorithm.

Parameters:
  • RGB (ArrayLike) – RGB colourspace array to recover spectral values from. The last dimension must be size 3.

  • as_array (bool) – Whether to return raw spectral values as a numpy.ndarray of shape (*RGB.shape[:-1], wavelengths) instead of a MultiSpectralDistributions instance. Defaults to False.

Returns:

Recovered multi-spectral distributions, or the underlying spectral values when as_array=True.

Return type:

MultiSpectralDistributions or numpy.ndarray

Notes

Domain

Scale - Reference

Scale - 1

RGB

1

1

Examples

>>> import numpy as np
>>> RGB = np.array(
...     [
...         [0.45623196, 0.03080455, 0.04093343],
...         [0.05438271, 0.29877169, 0.07188444],
...         [0.01863137, 0.05139773, 0.28887675],
...     ]
... )
>>> RGB_to_msds_Gaussian(RGB, as_array=True).shape
(3, 421)
>>> float(RGB_to_msds_Gaussian(RGB, as_array=True)[0, 300])
...
0.4561...