colour.recovery.RGB_to_sd_Smits1999#

colour.recovery.RGB_to_sd_Smits1999(RGB: Domain1, basis: MultiSpectralDistributions | None = None, name: str | None = None) SpectralDistribution[source]#

Generate a spectral distribution from RGB values using the Smits (1999) decomposition algorithm.

Parameters:
  • RGB (Domain1) – RGB colourspace array to recover the spectral distribution from.

  • basis (MultiSpectralDistributions | None) – Multi-spectral distributions basis with signals: white, cyan, magenta, yellow, red, green, blue. Defaults to MSDS_SMITS1999.

  • name (str | None) – Name for the resulting spectral distribution.

Returns:

Recovered spectral distribution.

Return type:

colour.SpectralDistribution

Notes

Domain

Scale - Reference

Scale - 1

RGB

1

1

References

[Smi99]

Examples

>>> import numpy as np
>>> from colour import MSDS_CMFS, SDS_ILLUMINANTS, SpectralShape
>>> from colour.colorimetry import sd_to_XYZ_integration
>>> from colour.utilities import numpy_print_options
>>> XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
>>> RGB = XYZ_to_RGB_Smits1999(XYZ)
>>> cmfs = (
...     MSDS_CMFS["CIE 1931 2 Degree Standard Observer"]
...     .copy()
...     .align(SpectralShape(360, 780, 10))
... )
>>> illuminant = SDS_ILLUMINANTS["E"].copy().align(cmfs.shape)
>>> sd = RGB_to_sd_Smits1999(RGB)
>>> with numpy_print_options(suppress=True):
...     sd
SpectralDistribution([[380.        ,   0.0787830...],
                      [417.7778    ,   0.0622018...],
                      [455.5556    ,   0.0446206...],
                      [493.3333    ,   0.0352220...],
                      [531.1111    ,   0.0324149...],
                      [568.8889    ,   0.0330105...],
                      [606.6667    ,   0.3207115...],
                      [644.4444    ,   0.3836164...],
                      [682.2222    ,   0.3836164...],
                      [720.        ,   0.3835649...]],
                     LinearInterpolator,
                     {},
                     Extrapolator,
                     {'method': 'Constant', 'left': None, 'right': None})
>>> sd_to_XYZ_integration(sd, cmfs, illuminant) / 100
array([0.1894770..., 0.1126470..., 0.0474420...])