colour.recovery.RGB_to_sd_Mallett2019#

colour.recovery.RGB_to_sd_Mallett2019(RGB: ArrayLike, basis_functions: MultiSpectralDistributions = MSDS_BASIS_FUNCTIONS_sRGB_MALLETT2019) SpectralDistribution[source]#

Recover the spectral distribution of given RGB colourspace array using Mallett and Yuksel (2019) method.

Parameters:
Returns:

Recovered reflectance.

Return type:

colour.SpectralDistribution

References

[MY19]

Notes

  • In-addition to the BT.709 primaries used by the sRGB colourspace, [MY19] tried BT.2020, P3 D65, Adobe RGB 1998, NTSC (1987), Pal/Secam, ProPhoto RGB, and Adobe Wide Gamut RGB primaries, every one of which encompasses a larger (albeit not-always-enveloping) set of CIE L*a*b* colours than BT.709. Of these, only Pal/Secam produces a feasible basis, which is relatively unsurprising since it is very similar to BT.709, whereas the others are significantly larger.

Examples

>>> from colour import MSDS_CMFS, SDS_ILLUMINANTS, XYZ_to_sRGB
>>> from colour.colorimetry import sd_to_XYZ_integration
>>> from colour.recovery import SPECTRAL_SHAPE_sRGB_MALLETT2019
>>> from colour.utilities import numpy_print_options
>>> XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
>>> RGB = XYZ_to_sRGB(XYZ, apply_cctf_encoding=False)
>>> cmfs = (
...     MSDS_CMFS["CIE 1931 2 Degree Standard Observer"]
...     .copy()
...     .align(SPECTRAL_SHAPE_sRGB_MALLETT2019)
... )
>>> illuminant = SDS_ILLUMINANTS["D65"].copy().align(cmfs.shape)
>>> sd = RGB_to_sd_Mallett2019(RGB)
>>> with numpy_print_options(suppress=True):
...     sd  
SpectralDistribution([[ 380.        ,    0.1735531...],
                      [ 385.        ,    0.1720357...],
                      [ 390.        ,    0.1677721...],
                      [ 395.        ,    0.1576605...],
                      [ 400.        ,    0.1372829...],
                      [ 405.        ,    0.1170849...],
                      [ 410.        ,    0.0895694...],
                      [ 415.        ,    0.0706232...],
                      [ 420.        ,    0.0585765...],
                      [ 425.        ,    0.0523959...],
                      [ 430.        ,    0.0497598...],
                      [ 435.        ,    0.0476057...],
                      [ 440.        ,    0.0465079...],
                      [ 445.        ,    0.0460337...],
                      [ 450.        ,    0.0455839...],
                      [ 455.        ,    0.0452872...],
                      [ 460.        ,    0.0450981...],
                      [ 465.        ,    0.0448895...],
                      [ 470.        ,    0.0449257...],
                      [ 475.        ,    0.0448987...],
                      [ 480.        ,    0.0446834...],
                      [ 485.        ,    0.0441372...],
                      [ 490.        ,    0.0417137...],
                      [ 495.        ,    0.0373832...],
                      [ 500.        ,    0.0357657...],
                      [ 505.        ,    0.0348263...],
                      [ 510.        ,    0.0341953...],
                      [ 515.        ,    0.0337683...],
                      [ 520.        ,    0.0334979...],
                      [ 525.        ,    0.0332991...],
                      [ 530.        ,    0.0331909...],
                      [ 535.        ,    0.0332181...],
                      [ 540.        ,    0.0333387...],
                      [ 545.        ,    0.0334970...],
                      [ 550.        ,    0.0337381...],
                      [ 555.        ,    0.0341847...],
                      [ 560.        ,    0.0346447...],
                      [ 565.        ,    0.0353993...],
                      [ 570.        ,    0.0367367...],
                      [ 575.        ,    0.0392007...],
                      [ 580.        ,    0.0445902...],
                      [ 585.        ,    0.0625633...],
                      [ 590.        ,    0.2965381...],
                      [ 595.        ,    0.4215576...],
                      [ 600.        ,    0.4347139...],
                      [ 605.        ,    0.4385134...],
                      [ 610.        ,    0.4385184...],
                      [ 615.        ,    0.4385249...],
                      [ 620.        ,    0.4374694...],
                      [ 625.        ,    0.4384672...],
                      [ 630.        ,    0.4368251...],
                      [ 635.        ,    0.4340867...],
                      [ 640.        ,    0.4303219...],
                      [ 645.        ,    0.4243257...],
                      [ 650.        ,    0.4159482...],
                      [ 655.        ,    0.4057443...],
                      [ 660.        ,    0.3919874...],
                      [ 665.        ,    0.3742784...],
                      [ 670.        ,    0.3518421...],
                      [ 675.        ,    0.3240127...],
                      [ 680.        ,    0.2955145...],
                      [ 685.        ,    0.2625658...],
                      [ 690.        ,    0.2343423...],
                      [ 695.        ,    0.2174830...],
                      [ 700.        ,    0.2060461...],
                      [ 705.        ,    0.1977437...],
                      [ 710.        ,    0.1916846...],
                      [ 715.        ,    0.1861020...],
                      [ 720.        ,    0.1823908...],
                      [ 725.        ,    0.1807923...],
                      [ 730.        ,    0.1795571...],
                      [ 735.        ,    0.1785623...],
                      [ 740.        ,    0.1775758...],
                      [ 745.        ,    0.1771614...],
                      [ 750.        ,    0.1767431...],
                      [ 755.        ,    0.1764319...],
                      [ 760.        ,    0.1762597...],
                      [ 765.        ,    0.1762209...],
                      [ 770.        ,    0.1761803...],
                      [ 775.        ,    0.1761195...],
                      [ 780.        ,    0.1760763...]],
                     SpragueInterpolator,
                     {},
                     Extrapolator,
                     {'method': 'Constant', 'left': None, 'right': None})
>>> sd_to_XYZ_integration(sd, cmfs, illuminant) / 100
... 
array([ 0.2065436...,  0.1219996...,  0.0513764...])