colour.appearance.nayatani95 Module

Nayatani (1995) Colour Appearance Model

Defines Nayatani (1995) colour appearance model objects:

References

[1]Mark D. Fairchild, Color Appearance Models, 3nd Edition, The Wiley-IS&T Series in Imaging Science and Technology, published June 2013, ASIN: B00DAYO8E2, Locations 4810-5085.
[2]Y. Nayatani, H. Sobagaki & K. H. T. Yano, Lightness dependency of chroma scales of a nonlinear color-appearance model and its latest formulation, Color Research & Application, Volume 20, Issue 3, pages 156–167, June 1995
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 colourspace 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 Mark D. Fairchild reference.

Parameters:
  • Lstar_P (numeric) – Correlate of achromatic Lightness \(L_p^\star\).
  • C (numeric) – Correlate of chroma \(C\).
  • theta (numeric) – Hue angle \(\theta\) in degrees.
  • S (numeric) – Correlate of saturation \(S\).
  • B_r (numeric) – Correlate of brightness \(B_r\).
  • M (numeric) – Correlate of colourfulness \(M\).
  • H (numeric) – Hue \(h\) quadrature \(H\).
  • H_C (numeric) – Hue \(h\) composition \(H_C\).
  • Lstar_N (numeric) – 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 Mark D. Fairchild reference.

Parameters:
  • Lstar_P (numeric) – Correlate of achromatic Lightness \(L_p^\star\).
  • C (numeric) – Correlate of chroma \(C\).
  • h (numeric) – Hue angle \(\theta\) in degrees.
  • s (numeric) – Correlate of saturation \(S\).
  • Q (numeric) – Correlate of brightness \(B_r\).
  • M (numeric) – Correlate of colourfulness \(M\).
  • H (numeric) – Hue \(h\) quadrature \(H\).
  • HC (numeric) – Hue \(h\) composition \(H_C\).
  • Lstar_N (numeric) – 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, (3,)) – CIE XYZ colourspace matrix of test sample / stimulus in domain [0, 100].
  • XYZ_n (array_like, (3,)) – CIE XYZ colourspace matrix of reference white in domain [0, 100].
  • Y_o (numeric) – Luminance factor \(Y_o\) of achromatic background as percentage in domain [0.18,]
  • E_o (numeric) – Illuminance \(E_o\) of the viewing field in lux.
  • E_or (numeric) – Normalising illuminance \(E_{or}\) in lux usually in domain [1000, 3000]
  • n (numeric, 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 colourspace matrix is in domain [0, 100].
  • Input CIE XYZ_n colourspace matrix is in domain [0, 100].
Raises:ValueError – If Luminance factor \(Y_o\) is not greater or equal than 18%.

Examples

>>> XYZ = np.array([19.01, 20, 21.78])
>>> XYZ_n = np.array([95.05, 100, 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) – Illuminance \(E\) in lux.
  • Y_f (numeric) – Luminance factor \(Y_f\) in \(cd/m^2\).
Returns:

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

Return type:

numeric

Examples

>>> illuminance_to_luminance(5000.0, 20.0)  
318.3098861...
colour.appearance.nayatani95.intermediate_values(XYZ_n)[source]

Returns the intermediate values \(\xi\), \(\eta\), \(\zeta\).

Parameters:XYZ_n (array_like, (3,)) – CIE XYZ colourspace matrix of reference white in domain [0, 100].
Returns:Intermediate values \(\xi\), \(\eta\), \(\zeta\).
Return type:ndarray, (3,)

Examples

>>> XYZ_n = np.array([95.05, 100, 108.88])
>>> intermediate_values(XYZ_n)  
array([ 1.0000421...,  0.9999800...,  0.9997579...])
colour.appearance.nayatani95.XYZ_to_RGB_Nayatani95(XYZ)[source]

Converts from CIE XYZ colourspace to cone responses.

Parameters:XYZ (array_like, (3,)) – CIE XYZ colourspace matrix.
Returns:Cone responses.
Return type:ndarray, (3,)

Examples

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

Computes the exponent \(\beta_1\) for the middle and long-wavelength sensitive cones.

Parameters:x (numeric) – Middle and long-wavelength sensitive cone response.
Returns:Exponent \(\beta_1\).
Return type:numeric

Examples

>>> beta_1(318.323316315)  
4.6106222...
colour.appearance.nayatani95.beta_2(x)[source]

Computes the exponent \(\beta_2\) for the short-wavelength sensitive cones.

Parameters:x (numeric) – Short-wavelength sensitive cone response.
Returns:Exponent \(\beta_2\).
Return type:numeric

Examples

>>> beta_2(318.323316315)  
4.6522416...
colour.appearance.nayatani95.chromatic_adaptation_exponential_factors(RGB_o)[source]

Returns the chromatic adaptation exponential factors \(\beta_1(R_o)\), math:beta_1(G_o)` and \(\beta_2(B_o)\) of given cone responses.

Parameters:RGB_o (ndarray, (3,)) – Cone responses.
Returns:Chromatic adaptation exponential factors \(\beta_1(R_o)\), math:beta_1(G_o)` and \(\beta_2(B_o)\).
Return type:ndarray, (3,)

Examples

>>> RGB_o = np.array([318.32331631, 318.30352317, 318.23283482])
>>> chromatic_adaptation_exponential_factors(RGB_o)  
array([ 4.6106222...,  4.6105892...,  4.6520698...])
colour.appearance.nayatani95.scaling_coefficient(x, y)[source]

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

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

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

Return type:

numeric

Examples

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

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

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

Achromatic response \(Q\).

Return type:

numeric

Examples

>>> RGB = np.array([20.0005206, 19.999783, 19.9988316])
>>> bRGB_o = np.array([4.61062223, 4.61058926, 4.65206986])
>>> x_e_z = 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, x_e_z, bL_or, eR, eG, n)    
-0.0001169...
colour.appearance.nayatani95.tritanopic_response(RGB, bRGB_o, x_e_z, n)[source]

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

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

Tritanopic response \(t\).

Return type:

numeric

Examples

>>> RGB = np.array([20.0005206, 19.999783, 19.9988316])
>>> bRGB_o = np.array([4.61062223, 4.61058926, 4.65206986])
>>> x_e_z = np.array([1.00004219, 0.99998001, 0.99975794])
>>> n = 1.0
>>> tritanopic_response(RGB, bRGB_o, x_e_z, n)  
-1.7703650...e-05
colour.appearance.nayatani95.protanopic_response(RGB, bRGB_o, x_e_z, n)[source]

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

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

Protanopic response \(p\).

Return type:

numeric

Examples

>>> RGB = np.array([20.0005206, 19.999783, 19.9988316])
>>> bRGB_o = np.array([4.61062223, 4.61058926, 4.65206986])
>>> x_e_z = np.array([1.00004219, 0.99998001, 0.99975794])
>>> n = 1.0
>>> protanopic_response(RGB, bRGB_o, x_e_z, 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, (3,)) – Chromatic adaptation exponential factors \(\beta_1(R_o)\), math:beta_1(G_o)` and \(\beta_2(B_o)\).
  • bL_or (numeric) – Normalising chromatic adaptation exponential factor \(\beta_1(B_or)\).
  • Q (numeric) – Achromatic response \(Q\).
Returns:

Brightness correlate \(B_r\).

Return type:

numeric

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, x_e_z, bL_or, n)[source]

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

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

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

Return type:

numeric

Examples

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

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

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

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) – Brightness correlate \(B_r\).
  • B_rw (numeric) – Ideal white brightness correlate \(B_{rw}\).
Returns:

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

Return type:

numeric

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) – Protanopic response \(p\).
  • t (numeric) – Tritanopic response \(t\).
Returns:

Hue angle \(h\) in degrees.

Return type:

numeric

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) – Correlate of hue \(h\) in degrees.
  • bL_or (numeric) – Normalising chromatic adaptation exponential factor \(\beta_1(B_or)\).
  • t (numeric) – Tritanopic response \(t\).
  • p (numeric) – Protanopic response \(p\).
Returns:

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

Return type:

numeric

Examples

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

Returns the correlate of saturation \(S\).

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

Correlate of saturation \(S\).

Return type:

numeric

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) – Achromatic Lightness correlate \(L_p^\star\).
  • S_RG (numeric) – Saturation component \(S_{RG}\).
  • S_YB (numeric) – Saturation component \(S_{YB}\).
Returns:

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

Return type:

numeric

Examples

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

Returns the correlate of chroma \(C\).

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

Correlate of chroma \(C\).

Return type:

numeric

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) – Chroma component \(C_{RG}\).
  • C_YB (numeric) – Chroma component \(C_{YB}\).
  • B_rw (numeric) – Ideal white brightness correlate \(B_{rw}\).
Returns:

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

Return type:

numeric

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) – Correlate of chroma \(C\).
  • B_rw (numeric) – Ideal white brightness correlate \(B_{rw}\).
Returns:

Correlate of colourfulness \(M\).

Return type:

numeric

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) – Hue angle \(\theta\)
Returns:Corrected saturation scale.
Return type:numeric

Examples

>>> chromatic_strength_function(4.49462820973)  
1.2267869...