colour.delta_E#
- colour.delta_E(a: ArrayLike, b: ArrayLike, method: LiteralDeltaEMethod | str = 'CIE 2000', *, additional_data: Literal[False] = False, **kwargs: Any) NDArrayFloat[source]#
- colour.delta_E(a: ArrayLike, b: ArrayLike, method: LiteralDeltaEMethod | str = 'CIE 2000', *, additional_data: Literal[True], **kwargs: Any) DeltaE_Specification_CIE1976 | DeltaE_Specification_CIE1994 | DeltaE_Specification_CIE2000 | DeltaE_Specification_CMC | DeltaE_Specification_ITP | DeltaE_Specification_HyAB | DeltaE_Specification_HyCH | DeltaE_Specification_DIN99 | DeltaE_Specification_Luo2006
- colour.delta_E(a: ArrayLike, b: ArrayLike, method: LiteralDeltaEMethod | str = 'CIE 2000', *, additional_data: bool, **kwargs: Any) NDArrayFloat | DeltaE_Specification
Compute the colour difference \(\Delta E_{ab}\) between two specified CIE L*a*b*, \(IC_TC_P\), or \(J'a'b'\) colourspace arrays.
- Parameters:
a (ArrayLike) – CIE L*a*b*, \(IC_TC_P\), or \(J'a'b'\) colourspace array \(a\).
b (ArrayLike) – CIE L*a*b*, \(IC_TC_P\), or \(J'a'b'\) colourspace array \(b\).
method (LiteralDeltaEMethod | str) – Computation method.
additional_data (bool) – Whether to output additional data.
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) –
See the documentation of the available \(\Delta E_{ab}\) definitions.
Arguments for the \(\Delta E_{ab}\) definitions are passed as keyword arguments whose names are those of the \(\Delta E_{ab}\) definitions and values set as dictionaries. For example, when computing \(\Delta E_{DIN99}\), passing arguments to the
colour.delta_E_DIN99()definition is done as follows:delta_E( a, b, "DIN99", delta_E_DIN99={"method": "DIN99b"}, )
It is also possible to pass keyword arguments directly, but this is dangerous and could cause unexpected behaviour. For example:
delta_E( a, b, "DIN99", method="DIN99b", )
Because both the
colour.delta_E()andcolour.delta_E_DIN99()definitions have a method argument, this will raise an exception in thecolour.delta_E()definition.
- Returns:
Colour difference \(\Delta E_{ab}\). When
additional_data=True, a specification dataclass is returned containing the colour differencedEand additional component-wise colour difference terms depending on the selected method.- Return type:
numpy.ndarrayorDeltaE_Specification
References
[ASTMInternational07], [InternationalTUnion19], [LLW+17], [Lin03a], [Lin11], [Lin09b], [LCL06], [Mel13], [Wikipedia08a]
Examples
>>> import numpy as np >>> a = np.array([48.99183622, -0.10561667, 400.65619925]) >>> b = np.array([50.65907324, -0.11671910, 402.82235718]) >>> delta_E(a, b) np.float64(1.6709303...) >>> delta_E(a, b, method="CIE 2000") np.float64(1.6709303...) >>> delta_E(a, b, method="CIE 1976") np.float64(2.7335037...) >>> delta_E(a, b, method="CIE 1994") np.float64(1.6711191...) >>> delta_E(a, b, method="CIE 1994", textiles=True) ... np.float64(0.8404677...) >>> delta_E(a, b, method="DIN99") np.float64(1.5591089...) >>> a = np.array([0.4885468072, -0.04739350675, 0.07475401302]) >>> b = np.array([0.4899203231, -0.04567508203, 0.07361341775]) >>> delta_E(a, b, method="ITP") np.float64(1.42657228...) >>> a = np.array([54.90433134, -0.08450395, -0.06854831]) >>> b = np.array([54.90433134, -0.08442362, -0.06848314]) >>> delta_E(a, b, method="CAM02-UCS") np.float64(0.0001034...) >>> delta_E(a, b, method="CAM16-LCD") np.float64(0.0001034...) >>> a = np.array([39.91531343, 51.16658481, 146.12933781]) >>> b = np.array([53.12207516, -39.92365056, 249.54831278]) >>> delta_E(a, b, method="HyAB") np.float64(151.0215481...) >>> a = np.array([39.91531343, 51.16658481, 146.12933781]) >>> b = np.array([53.12207516, -39.92365056, 249.54831278]) >>> delta_E(a, b, method="HyCH") np.float64(48.66427941...)