colour.difference.sd_to_metamerism_index#
- colour.difference.sd_to_metamerism_index(sd_spl: SpectralDistribution | MultiSpectralDistributions, sd_std: SpectralDistribution | MultiSpectralDistributions, cmfs: MultiSpectralDistributions, illuminant_r: SpectralDistribution, illuminant_t: SpectralDistribution, method: LiteralDeltaEMethod | str = 'CIE 2000', **kwargs: Any) NDArrayFloat[source]#
Compute the metamerism index \(M_t\) of a sample pair for change of illuminant using the spectral correction method as defined in ISO 18314-4:2024.
The spectral correction method (Cohen-Kappauf matrix decomposition) computes a corrected spectral distribution \(\bar{N}_{spl,corr}\) such that the sample and standard have identical tristimulus values under the reference illuminant. The metamerism index is then calculated as the colour difference between the standard and corrected sample under the test illuminant.
The projection matrix \(R\) is computed from the weighting matrix \(A\) as:
\(R = A \cdot (A^T \cdot A)^{-1} \cdot A^T\)
The corrected spectral distribution is:
\(\bar{N}_{spl,corr} = R \cdot \bar{N}_{std} + (I - R) \cdot \bar{N}_{spl}\)
- Parameters:
sd_spl (SpectralDistribution | MultiSpectralDistributions) – Spectral distribution of the sample \(\bar{N}_{spl}\).
sd_std (SpectralDistribution | MultiSpectralDistributions) – Spectral distribution of the standard \(\bar{N}_{std}\).
cmfs (MultiSpectralDistributions) – Standard observer colour matching functions.
illuminant_r (SpectralDistribution) – Spectral distribution of the reference illuminant.
illuminant_t (SpectralDistribution) – Spectral distribution of the test illuminant.
method (LiteralDeltaEMethod | str) – Colour difference formula.
illuminant – {
colour.models.XYZ_to_Lab()}, Test illuminant CIE xy chromaticity coordinates or CIE xyY colourspace array for conversion from CIE XYZ to CIE L*a*b*.c – {
colour.difference.delta_E_CMC()}, Chroma weighting factor.l – {
colour.difference.delta_E_CMC()}, Lightness weighting factor.textiles – {
colour.difference.delta_E_CIE1994(),colour.difference.delta_E_CIE2000(),colour.difference.delta_E_DIN99()}, Textiles application specific parametric factors \(k_L=2,\ k_C=k_H=1,\ k_1=0.048,\ k_2=0.014,\ k_E=2,\ k_{CH}=0.5\) weights are used instead of \(k_L=k_C=k_H=1,\ k_1=0.045,\ k_2=0.015,\ k_E=k_{CH}=1.0\).kwargs (Any)
- Returns:
Metamerism index \(M_t\).
- Return type:
Notes
This method implements ISO 18314-4:2024, Section 8.3.3, Spectral correction (Cohen-Kappauf matrix R).
The spectral correction ensures that \(\bar{W}_{std} = \bar{W}_{spl,corr}\) under the reference illuminant, i.e., the colour difference is zero.
References
[InternationalOfStandardization24]
Examples
>>> import numpy as np >>> from colour import MSDS_CMFS, SDS_ILLUMINANTS, CCS_ILLUMINANTS >>> from colour.colorimetry import SpectralShape >>> shape = SpectralShape(400, 700, 10) >>> N_spl = np.array( ... [ ... 0.0379, ... 0.0403, ... 0.0415, ... 0.0427, ... 0.045, ... 0.0483, ... 0.0521, ... 0.0572, ... 0.0624, ... 0.0673, ... 0.0777, ... 0.1026, ... 0.1307, ... 0.145, ... 0.1484, ... 0.1455, ... 0.1375, ... 0.1254, ... 0.1099, ... 0.0908, ... 0.0698, ... 0.0526, ... 0.0423, ... 0.0368, ... 0.0331, ... 0.0306, ... 0.0297, ... 0.0311, ... 0.034, ... 0.038, ... 0.0421, ... ] ... ) >>> N_std = np.array( ... [ ... 0.099, ... 0.1244, ... 0.0933, ... 0.0596, ... 0.0405, ... 0.0322, ... 0.0299, ... 0.0316, ... 0.0377, ... 0.0507, ... 0.0681, ... 0.0968, ... 0.1522, ... 0.2014, ... 0.1991, ... 0.159, ... 0.1162, ... 0.0843, ... 0.0655, ... 0.057, ... 0.0553, ... 0.0582, ... 0.0638, ... 0.0716, ... 0.0818, ... 0.0959, ... 0.1131, ... 0.1317, ... 0.149, ... 0.1656, ... 0.1832, ... ] ... ) >>> N_spl = SpectralDistribution(N_spl, shape) >>> N_std = SpectralDistribution(N_std, shape) >>> cmfs = MSDS_CMFS["CIE 1964 10 Degree Standard Observer"] >>> r = SDS_ILLUMINANTS["D65"] >>> t = SDS_ILLUMINANTS["A"] >>> sd_to_metamerism_index( ... N_spl, ... N_std, ... cmfs, ... r, ... t, ... method="CIE 1976", ... illuminant=colour.CCS_ILLUMINANTS["CIE 1964 10 Degree Standard Observer"][ ... "A" ... ], ... ) np.float64(3.4766679...)