Processing math: 100%

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, DOI: https://doi.org/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 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 Lp.
  • C (numeric) – Correlate of chroma C.
  • theta (numeric) – Hue angle θ in degrees.
  • S (numeric) – Correlate of saturation S.
  • B_r (numeric) – Correlate of brightness Br.
  • M (numeric) – Correlate of colourfulness M.
  • H (numeric) – Hue h quadrature H.
  • H_C (numeric) – Hue h composition HC.
  • Lstar_N (numeric) – Correlate of normalised achromatic Lightness Ln.
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 Lp.
  • C (numeric) – Correlate of chroma C.
  • h (numeric) – Hue angle θ in degrees.
  • s (numeric) – Correlate of saturation S.
  • Q (numeric) – Correlate of brightness Br.
  • M (numeric) – Correlate of colourfulness M.
  • H (numeric) – Hue h quadrature H.
  • HC (numeric) – Hue h composition HC.
  • Lstar_N (numeric) – Correlate of normalised achromatic Lightness Ln.
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 Yo of achromatic background as percentage in domain [0.18,]
  • E_o (numeric) – Illuminance Eo of the viewing field in lux.
  • E_or (numeric) – Normalising illuminance Eor 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 Yo 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/m2.

Parameters:
  • E (numeric) – Illuminance E in lux.
  • Y_f (numeric) – Luminance factor Yf in cd/m2.
Returns:

Luminance Y in cd/m2.

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 ξ, η, ζ.

Parameters:XYZ_n (array_like, (3,)) – CIE XYZ colourspace matrix of reference white in domain [0, 100].
Returns:Intermediate values ξ, η, ζ.
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 β1 for the middle and long-wavelength sensitive cones.

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

Examples

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

Computes the exponent β2 for the short-wavelength sensitive cones.

Parameters:x (numeric) – Short-wavelength sensitive cone response.
Returns:Exponent β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 β1(Ro), math:beta_1(G_o)` and β2(Bo) of given cone responses.

Parameters:RGB_o (ndarray, (3,)) – Cone responses.
Returns:Chromatic adaptation exponential factors β1(Ro), math:beta_1(G_o)` and β2(Bo).
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 β1(Ro), math:beta_1(G_o)` and β2(Bo).
  • x_e_z (ndarray, (3,)) – Intermediate values ξ, η, ζ.
  • bL_or (numeric) – Normalising chromatic adaptation exponential factor β1(Bor).
  • 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 β1(Ro), math:beta_1(G_o)` and β2(Bo).
  • x_e_z (ndarray, (3,)) – Intermediate values ξ, η, ζ.
  • 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 β1(Ro), math:beta_1(G_o)` and β2(Bo).
  • x_e_z (ndarray, (3,)) – Intermediate values ξ, η, ζ.
  • 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 Br.

Parameters:
  • bRGB_o (ndarray, (3,)) – Chromatic adaptation exponential factors β1(Ro), math:beta_1(G_o)` and β2(Bo).
  • bL_or (numeric) – Normalising chromatic adaptation exponential factor β1(Bor).
  • Q (numeric) – Achromatic response Q.
Returns:

Brightness correlate Br.

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 Brw.

Parameters:
  • bRGB_o (ndarray, (3,)) – Chromatic adaptation exponential factors β1(Ro), math:beta_1(G_o)` and β2(Bo).
  • x_e_z (ndarray, (3,)) – Intermediate values ξ, η, ζ.
  • bL_or (numeric) – Normalising chromatic adaptation exponential factor β1(Bor).
  • n (numeric, optional) – Noise term used in the non linear chromatic adaptation model.
Returns:

Ideal white brightness correlate Brw.

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 Lp.

Parameters:Q (numeric) – Achromatic response Q.
Returns:Achromatic Lightness correlate Lp.
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 Ln.

Parameters:
  • B_r (numeric) – Brightness correlate Br.
  • B_rw (numeric) – Ideal white brightness correlate Brw.
Returns:

Normalised achromatic Lightness correlate Ln.

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 SRG and SYB.

Parameters:
  • h (numeric) – Correlate of hue h in degrees.
  • bL_or (numeric) – Normalising chromatic adaptation exponential factor β1(Bor).
  • t (numeric) – Tritanopic response t.
  • p (numeric) – Protanopic response p.
Returns:

Saturation components SRG and SYB.

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 SRG.
  • S_YB (numeric) – Saturation component SYB.
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 CRG and CYB.

Parameters:
  • Lstar_P (numeric) – Achromatic Lightness correlate Lp.
  • S_RG (numeric) – Saturation component SRG.
  • S_YB (numeric) – Saturation component SYB.
Returns:

Chroma components CRG and CYB.

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 Lp.
  • 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 MRG and MYB.

Parameters:
  • C_RG (numeric) – Chroma component CRG.
  • C_YB (numeric) – Chroma component CYB.
  • B_rw (numeric) – Ideal white brightness correlate Brw.
Returns:

Colourfulness components MRG and MYB.

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 Brw.
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 Es(θ) used to correct saturation scale as function of hue angle θ.

Parameters:theta (numeric) – Hue angle θ
Returns:Corrected saturation scale.
Return type:numeric

Examples

>>> chromatic_strength_function(4.49462820973)  
1.2267869...