colour.appearance.nayatani95 Module

Nayatani (1995) Colour Appearance Model

Defines Nayatani (1995) colour appearance model objects:

References

[1]Fairchild, M. D. (2013). The Nayatani et al. Model. In Color Appearance Models (3rd ed., pp. 4810–5085). Wiley. ASIN:B00DAYO8E2
[2]Nayatani, Y., Sobagaki, H., & Yano, K. H. T. (1995). Lightness dependency of chroma scales of a nonlinear color-appearance model and its latest formulation. Color Research & Application, 20(3), 156–167. doi:10.1002/col.5080200305
colour.appearance.nayatani95.NAYATANI95_XYZ_TO_RGB_MATRIX = array([[ 0.40024, 0.7076 , -0.08081], [-0.2263 , 1.16532, 0.0457 ], [ 0. , 0. , 0.91822]])

Nayatani (1995) colour appearance model CIE XYZ tristimulus values to cone responses matrix.

NAYATANI95_XYZ_TO_RGB_MATRIX : array_like, (3, 3)

class colour.appearance.nayatani95.Nayatani95_ReferenceSpecification[source]

Bases: colour.appearance.nayatani95.Nayatani95_ReferenceSpecification

Defines the Nayatani (1995) colour appearance model reference specification.

This specification has field names consistent with Fairchild (2013) reference.

Parameters:
  • Lstar_P (numeric or array_like) – Correlate of achromatic Lightness \(L_p^\star\).
  • C (numeric or array_like) – Correlate of chroma \(C\).
  • theta (numeric or array_like) – Hue angle \(\theta\) in degrees.
  • S (numeric or array_like) – Correlate of saturation \(S\).
  • B_r (numeric or array_like) – Correlate of brightness \(B_r\).
  • M (numeric or array_like) – Correlate of colourfulness \(M\).
  • H (numeric or array_like) – Hue \(h\) quadrature \(H\).
  • H_C (numeric or array_like) – Hue \(h\) composition \(H_C\).
  • Lstar_N (numeric or array_like) – Correlate of normalised achromatic Lightness \(L_n^\star\).
class colour.appearance.nayatani95.Nayatani95_Specification[source]

Bases: colour.appearance.nayatani95.Nayatani95_Specification

Defines the Nayatani (1995) colour appearance model specification.

This specification has field names consistent with the remaining colour appearance models in colour.appearance but diverge from Fairchild (2013) reference.

Parameters:
  • Lstar_P (numeric or array_like) – Correlate of achromatic Lightness \(L_p^\star\).
  • C (numeric or array_like) – Correlate of chroma \(C\).
  • h (numeric or array_like) – Hue angle \(\theta\) in degrees.
  • s (numeric or array_like) – Correlate of saturation \(S\).
  • Q (numeric or array_like) – Correlate of brightness \(B_r\).
  • M (numeric or array_like) – Correlate of colourfulness \(M\).
  • H (numeric or array_like) – Hue \(h\) quadrature \(H\).
  • HC (numeric or array_like) – Hue \(h\) composition \(H_C\).
  • Lstar_N (numeric or array_like) – Correlate of normalised achromatic Lightness \(L_n^\star\).
colour.appearance.nayatani95.XYZ_to_Nayatani95(XYZ, XYZ_n, Y_o, E_o, E_or, n=1)[source]

Computes the Nayatani (1995) colour appearance model correlates.

Parameters:
  • XYZ (array_like) – CIE XYZ tristimulus values of test sample / stimulus in domain [0, 100].
  • XYZ_n (array_like) – CIE XYZ tristimulus values of reference white in domain [0, 100].
  • Y_o (numeric or array_like) – Luminance factor \(Y_o\) of achromatic background as percentage in domain [0.18, 1.0]
  • E_o (numeric or array_like) – Illuminance \(E_o\) of the viewing field in lux.
  • E_or (numeric or array_like) – Normalising illuminance \(E_{or}\) in lux usually in domain [1000, 3000]
  • n (numeric or array_like, optional) – Noise term used in the non linear chromatic adaptation model.
Returns:

Nayatani (1995) colour appearance model specification.

Return type:

Nayatani95_Specification

Warning

The input domain of that definition is non standard!

Notes

  • Input CIE XYZ tristimulus values are in domain [0, 100].
  • Input CIE XYZ_n tristimulus values are in domain [0, 100].

Examples

>>> XYZ = np.array([19.01, 20.00, 21.78])
>>> XYZ_n = np.array([95.05, 100.00, 108.88])
>>> Y_o = 20.0
>>> E_o = 5000.0
>>> E_or = 1000.0
>>> XYZ_to_Nayatani95(XYZ, XYZ_n, Y_o, E_o, E_or)  
Nayatani95_Specification(Lstar_P=49.9998829..., C=0.0133550..., h=257.5232268..., s=0.0133550..., Q=62.6266734..., M=0.0167262..., H=None, HC=None, Lstar_N=50.0039154...)
colour.appearance.nayatani95.illuminance_to_luminance(E, Y_f)[source]

Converts given illuminance \(E\) value in lux to luminance in \(cd/m^2\).

Parameters:
  • E (numeric or array_like) – Illuminance \(E\) in lux.
  • Y_f (numeric or array_like) – Luminance factor \(Y_f\) in \(cd/m^2\).
Returns:

Luminance \(Y\) in \(cd/m^2\).

Return type:

numeric or ndarray

Examples

>>> illuminance_to_luminance(5000.0, 20.0)  
318.3098861...
colour.appearance.nayatani95.XYZ_to_RGB_Nayatani95(XYZ)[source]

Converts from CIE XYZ tristimulus values to cone responses.

Parameters:XYZ (array_like) – CIE XYZ tristimulus values.
Returns:Cone responses.
Return type:ndarray

Examples

>>> XYZ = np.array([19.01, 20.00, 21.78])
>>> XYZ_to_RGB_Nayatani95(XYZ)  
array([ 20.000520...,  19.999783...,  19.998831...])
colour.appearance.nayatani95.scaling_coefficient(x, y)[source]

Returns the scaling coefficient \(e(R)\) or \(e(G)\).

Parameters:
  • x (numeric or array_like) – Cone response.
  • y (numeric or array_like) – Intermediate value.
Returns:

Scaling coefficient \(e(R)\) or \(e(G)\).

Return type:

numeric or ndarray

Examples

>>> x = 20.000520600000002
>>> y = 1.000042192
>>> scaling_coefficient(x, y)
array(1.0)
colour.appearance.nayatani95.achromatic_response(RGB, bRGB_o, xez, bL_or, eR, eG, n=1)[source]

Returns the achromatic response \(Q\) from given stimulus cone responses.

Parameters:
  • RGB (ndarray) – Stimulus cone responses.
  • bRGB_o (ndarray) – Chromatic adaptation exponential factors \(\beta_1(R_o)\), \(\beta_1(G_o)\) and \(\beta_2(B_o)\).
  • xez (ndarray) – Intermediate values \(\xi\), \(\eta\), \(\zeta\).
  • bL_or (numeric or array_like) – Normalising chromatic adaptation exponential factor \(\beta_1(B_or)\).
  • eR (numeric or array_like) – Scaling coefficient \(e(R)\).
  • eG (numeric or array_like) – Scaling coefficient \(e(G)\).
  • n (numeric or array_like, optional) – Noise term used in the non linear chromatic adaptation model.
Returns:

Achromatic response \(Q\).

Return type:

numeric or ndarray

Examples

>>> RGB = np.array([20.00052060, 19.99978300, 19.99883160])
>>> bRGB_o = np.array([4.61062223, 4.61058926, 4.65206986])
>>> xez = np.array([1.00004219, 0.99998001, 0.99975794])
>>> bL_or = 3.6810214956040888
>>> eR = 1.0
>>> eG = 1.758
>>> n = 1.0
>>> achromatic_response(  
...     RGB, bRGB_o, xez, bL_or, eR, eG, n)
-0.0001169...
colour.appearance.nayatani95.tritanopic_response(RGB, bRGB_o, xez, n)[source]

Returns the tritanopic response \(t\) from given stimulus cone responses.

Parameters:
  • RGB (ndarray) – Stimulus cone responses.
  • bRGB_o (ndarray) – Chromatic adaptation exponential factors \(\beta_1(R_o)\), \(\beta_1(G_o)\) and \(\beta_2(B_o)\).
  • xez (ndarray) – Intermediate values \(\xi\), \(\eta\), \(\zeta\).
  • n (numeric or array_like, optional) – Noise term used in the non linear chromatic adaptation model.
Returns:

Tritanopic response \(t\).

Return type:

numeric or ndarray

Examples

>>> RGB = np.array([20.00052060, 19.99978300, 19.99883160])
>>> bRGB_o = np.array([4.61062223, 4.61058926, 4.65206986])
>>> xez = np.array([1.00004219, 0.99998001, 0.99975794])
>>> n = 1.0
>>> tritanopic_response(RGB, bRGB_o, xez, n)  
-1.7703650...e-05
colour.appearance.nayatani95.protanopic_response(RGB, bRGB_o, xez, n)[source]

Returns the protanopic response \(p\) from given stimulus cone responses.

Parameters:
  • RGB (ndarray) – Stimulus cone responses.
  • bRGB_o (ndarray) – Chromatic adaptation exponential factors \(\beta_1(R_o)\), \(\beta_1(G_o)\) and \(\beta_2(B_o)\).
  • xez (ndarray) – Intermediate values \(\xi\), \(\eta\), \(\zeta\).
  • n (numeric or array_like, optional) – Noise term used in the non linear chromatic adaptation model.
Returns:

Protanopic response \(p\).

Return type:

numeric or ndarray

Examples

>>> RGB = np.array([20.00052060, 19.99978300, 19.99883160])
>>> bRGB_o = np.array([4.61062223, 4.61058926, 4.65206986])
>>> xez = np.array([1.00004219, 0.99998001, 0.99975794])
>>> n = 1.0
>>> protanopic_response(RGB, bRGB_o, xez, n)  
-8.0021426...e-05
colour.appearance.nayatani95.brightness_correlate(bRGB_o, bL_or, Q)[source]

Returns the brightness correlate \(B_r\).

Parameters:
  • bRGB_o (ndarray) – Chromatic adaptation exponential factors \(\beta_1(R_o)\), \(\beta_1(G_o)\) and \(\beta_2(B_o)\).
  • bL_or (numeric or array_like) – Normalising chromatic adaptation exponential factor \(\beta_1(B_or)\).
  • Q (numeric or array_like) – Achromatic response \(Q\).
Returns:

Brightness correlate \(B_r\).

Return type:

numeric or ndarray

Examples

>>> bRGB_o = np.array([4.61062223, 4.61058926, 4.65206986])
>>> bL_or = 3.6810214956040888
>>> Q = -0.000117024294955
>>> brightness_correlate(bRGB_o, bL_or, Q)  
62.6266734...
colour.appearance.nayatani95.ideal_white_brightness_correlate(bRGB_o, xez, bL_or, n)[source]

Returns the ideal white brightness correlate \(B_{rw}\).

Parameters:
  • bRGB_o (ndarray) – Chromatic adaptation exponential factors \(\beta_1(R_o)\), \(\beta_1(G_o)\) and \(\beta_2(B_o)\).
  • xez (ndarray) – Intermediate values \(\xi\), \(\eta\), \(\zeta\).
  • bL_or (numeric or array_like) – Normalising chromatic adaptation exponential factor \(\beta_1(B_or)\).
  • n (numeric or array_like, optional) – Noise term used in the non linear chromatic adaptation model.
Returns:

Ideal white brightness correlate \(B_{rw}\).

Return type:

numeric or ndarray

Examples

>>> bRGB_o = np.array([4.61062223, 4.61058926, 4.65206986])
>>> xez = np.array([1.00004219, 0.99998001, 0.99975794])
>>> bL_or = 3.6810214956040888
>>> n = 1.0
>>> ideal_white_brightness_correlate(  
...     bRGB_o, xez, bL_or, n)
125.2435392...
colour.appearance.nayatani95.achromatic_lightness_correlate(Q)[source]

Returns the achromatic Lightness correlate \(L_p^\star\).

Parameters:Q (numeric or array_like) – Achromatic response \(Q\).
Returns:Achromatic Lightness correlate \(L_p^\star\).
Return type:numeric or ndarray

Examples

>>> Q = -0.000117024294955
>>> achromatic_lightness_correlate(Q)  
49.9998829...
colour.appearance.nayatani95.normalised_achromatic_lightness_correlate(B_r, B_rw)[source]

Returns the normalised achromatic Lightness correlate \(L_n^\star\).

Parameters:
  • B_r (numeric or array_like) – Brightness correlate \(B_r\).
  • B_rw (numeric or array_like) – Ideal white brightness correlate \(B_{rw}\).
Returns:

Normalised achromatic Lightness correlate \(L_n^\star\).

Return type:

numeric or ndarray

Examples

>>> B_r = 62.626673467230766
>>> B_rw = 125.24353925846037
>>> normalised_achromatic_lightness_correlate(  
...     B_r, B_rw)
50.0039154...
colour.appearance.nayatani95.hue_angle(p, t)[source]

Returns the hue angle \(h\) in degrees.

Parameters:
  • p (numeric or array_like) – Protanopic response \(p\).
  • t (numeric or array_like) – Tritanopic response \(t\).
Returns:

Hue angle \(h\) in degrees.

Return type:

numeric or ndarray

Examples

>>> p = -8.002142682085493e-05
>>> t = -1.7703650668990973e-05
>>> hue_angle(p, t)  
257.5250300...
colour.appearance.nayatani95.saturation_components(h, bL_or, t, p)[source]

Returns the saturation components \(S_{RG}\) and \(S_{YB}\).

Parameters:
  • h (numeric or array_like) – Correlate of hue \(h\) in degrees.
  • bL_or (numeric or array_like) – Normalising chromatic adaptation exponential factor \(\beta_1(B_or)\).
  • t (numeric or array_like) – Tritanopic response \(t\).
  • p (numeric or array_like) – Protanopic response \(p\).
Returns:

Saturation components \(S_{RG}\) and \(S_{YB}\).

Return type:

numeric or ndarray

Examples

>>> h = 257.52322689806243
>>> bL_or = 3.6810214956040888
>>> t = -1.7706764677181658e-05
>>> p = -8.0023561356363753e-05
>>> saturation_components(h, bL_or, t, p)  
array([-0.0028852..., -0.0130396...])
colour.appearance.nayatani95.saturation_correlate(S_RG, S_YB)[source]

Returns the correlate of saturation \(S\).

Parameters:
  • S_RG (numeric or array_like) – Saturation component \(S_{RG}\).
  • S_YB (numeric or array_like) – Saturation component \(S_{YB}\).
Returns:

Correlate of saturation \(S\).

Return type:

numeric or ndarray

Examples

>>> S_RG = -0.0028852716381965863
>>> S_YB = -0.013039632941332499
>>> saturation_correlate(S_RG, S_YB)  
0.0133550...
colour.appearance.nayatani95.chroma_components(Lstar_P, S_RG, S_YB)[source]

Returns the chroma components \(C_{RG}\) and \(C_{YB}\).

Parameters:
  • Lstar_P (numeric or array_like) – Achromatic Lightness correlate \(L_p^\star\).
  • S_RG (numeric or array_like) – Saturation component \(S_{RG}\).
  • S_YB (numeric or array_like) – Saturation component \(S_{YB}\).
Returns:

Chroma components \(C_{RG}\) and \(C_{YB}\).

Return type:

ndarray

Examples

>>> Lstar_P = 49.99988297570504
>>> S_RG = -0.0028852716381965863
>>> S_YB = -0.013039632941332499
>>> chroma_components(Lstar_P, S_RG, S_YB)  
array([-0.00288527, -0.01303961])
colour.appearance.nayatani95.chroma_correlate(Lstar_P, S)[source]

Returns the correlate of chroma \(C\).

Parameters:
  • Lstar_P (numeric or array_like) – Achromatic Lightness correlate \(L_p^\star\).
  • S (numeric or array_like) – Correlate of saturation \(S\).
Returns:

Correlate of chroma \(C\).

Return type:

numeric or ndarray

Examples

>>> Lstar_P = 49.99988297570504
>>> S = 0.013355029751777615
>>> chroma_correlate(Lstar_P, S)  
0.0133550...
colour.appearance.nayatani95.colourfulness_components(C_RG, C_YB, B_rw)[source]

Returns the colourfulness components \(M_{RG}\) and \(M_{YB}\).

Parameters:
  • C_RG (numeric or array_like) – Chroma component \(C_{RG}\).
  • C_YB (numeric or array_like) – Chroma component \(C_{YB}\).
  • B_rw (numeric or array_like) – Ideal white brightness correlate \(B_{rw}\).
Returns:

Colourfulness components \(M_{RG}\) and \(M_{YB}\).

Return type:

numeric or ndarray

Examples

>>> C_RG = -0.0028852716381965863
>>> C_YB = -0.013039632941332499
>>> B_rw = 125.24353925846037
>>> colourfulness_components(C_RG, C_YB, B_rw)  
(-0.0036136..., -0.0163312...)
colour.appearance.nayatani95.colourfulness_correlate(C, B_rw)[source]

Returns the correlate of colourfulness \(M\).

Parameters:
  • C (numeric or array_like) – Correlate of chroma \(C\).
  • B_rw (numeric or array_like) – Ideal white brightness correlate \(B_{rw}\).
Returns:

Correlate of colourfulness \(M\).

Return type:

numeric or ndarray

Examples

>>> C = 0.013355007871688761
>>> B_rw = 125.24353925846037
>>> colourfulness_correlate(C, B_rw)  
0.0167262...
colour.appearance.nayatani95.chromatic_strength_function(theta)[source]

Defines the chromatic strength function \(E_s(\theta)\) used to correct saturation scale as function of hue angle \(\theta\).

Parameters:theta (numeric or array_like) – Hue angle \(\theta\)
Returns:Corrected saturation scale.
Return type:numeric or ndarray

Examples

>>> chromatic_strength_function(4.49462820973)  
1.2267869...