colour.recovery.XYZ_to_sd_Otsu2018¶
- colour.recovery.XYZ_to_sd_Otsu2018(XYZ, cmfs=XYZ_ColourMatchingFunctions(name='CIE 1931 2 Degree Standard Observer', ...), illuminant=SpectralDistribution(name='D65', ...), dataset=<colour.recovery.otsu2018.Dataset_Otsu2018 object>, clip=True)[source]¶
Recovers the spectral distribution of given CIE XYZ tristimulus values using Otsu et al. (2018) method.
- Parameters
XYZ (array_like, (3,)) – CIE XYZ tristimulus values to recover the spectral distribution from.
cmfs (XYZ_ColourMatchingFunctions, optional) – Standard observer colour matching functions.
illuminant (SpectralDistribution, optional) – Illuminant spectral distribution.
dataset (Dataset_Otsu2018, optional) – Dataset to use for reconstruction. The default is to use the published data.
clip (bool, optional) – If True, the default, values below zero and above unity in the recovered spectral distributions will be clipped. This ensures that the returned reflectance is physical and conserves energy, but will cause noticeable colour differences in case of very saturated colours.
- Returns
Recovered spectral distribution. Its shape is always that of the
colour.recovery.SPECTRAL_SHAPE_OTSU2018
class instance.- Return type
References
[]
Examples
>>> from colour.colorimetry import CCS_ILLUMINANTS, sd_to_XYZ_integration >>> from colour.models import XYZ_to_sRGB >>> from colour.utilities import numpy_print_options >>> XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) >>> cmfs = ( ... MSDS_CMFS_STANDARD_OBSERVER['CIE 1931 2 Degree Standard Observer']. ... copy().align(SPECTRAL_SHAPE_OTSU2018) ... ) >>> illuminant = SDS_ILLUMINANTS['D65'].copy().align(cmfs.shape) >>> sd = XYZ_to_sd_Otsu2018(XYZ, cmfs, illuminant) >>> with numpy_print_options(suppress=True): ... # Doctests skip for Python 2.x compatibility. ... sd SpectralDistribution([[ 380. , 0.0601939...], [ 390. , 0.0568063...], [ 400. , 0.0517429...], [ 410. , 0.0495841...], [ 420. , 0.0502007...], [ 430. , 0.0506489...], [ 440. , 0.0510020...], [ 450. , 0.0493782...], [ 460. , 0.0468046...], [ 470. , 0.0437132...], [ 480. , 0.0416957...], [ 490. , 0.0403783...], [ 500. , 0.0405197...], [ 510. , 0.0406031...], [ 520. , 0.0416912...], [ 530. , 0.0430956...], [ 540. , 0.0444474...], [ 550. , 0.0459336...], [ 560. , 0.0507631...], [ 570. , 0.0628967...], [ 580. , 0.0844661...], [ 590. , 0.1334277...], [ 600. , 0.2262428...], [ 610. , 0.3599330...], [ 620. , 0.4885571...], [ 630. , 0.5752546...], [ 640. , 0.6193023...], [ 650. , 0.6450744...], [ 660. , 0.6610548...], [ 670. , 0.6688673...], [ 680. , 0.6795426...], [ 690. , 0.6887933...], [ 700. , 0.7003469...], [ 710. , 0.7084128...], [ 720. , 0.7154674...], [ 730. , 0.7234334...]], interpolator=SpragueInterpolator, interpolator_kwargs={}, extrapolator=Extrapolator, extrapolator_kwargs={...}) >>> sd_to_XYZ_integration(sd, cmfs, illuminant) / 100 array([ 0.2065494..., 0.1219712..., 0.0514002...])