colour.appearance.llab Module¶
LLAB(l:c) Colour Appearance Model¶
Defines LLAB(l:c) colour appearance model objects:
References
[1] | Fairchild, M. D. (2013). LLAB Model. In Color Appearance Models (3rd ed., pp. 6025–6178). Wiley. ASIN:B00DAYO8E2 |
[2] | Luo, M. R., & Morovic, J. (1996). Two Unsolved Issues in Colour Management – Colour Appearance and Gamut Mapping. In Conference: 5th International Conference on High Technology: Imaging Science and Technology – Evolution & Promise (pp. 136–147). Retrieved from http://www.researchgate.net/publication/236348295_Two_Unsolved_Issues_in_Colour_Management_Colour_Appearance_and_Gamut_Mapping |
[3] | Luo, M. R., Lo, M.-C., & Kuo, W.-G. (1996). The LLAB (l:c) colour model. Color Research & Application, 21(6), 412–429. doi:10.1002/(SICI)1520-6378(199612)21:6<412::AID-COL4>3.0.CO;2-Z |
-
class
colour.appearance.llab.
LLAB_InductionFactors
[source]¶ Bases:
colour.appearance.llab.LLAB_InductionFactors
LLAB(l:c) colour appearance model induction factors.
Parameters: - D (numeric or array_like) – Discounting-the-Illuminant factor \(D\) in domain [0, 1].
- F_S (numeric or array_like) – Surround induction factor \(F_S\).
- F_L (numeric or array_like) – Lightness induction factor \(F_L\).
- F_C (numeric or array_like) – Chroma induction factor \(F_C\).
-
colour.appearance.llab.
LLAB_VIEWING_CONDITIONS
= CaseInsensitiveMapping({u'35mm Projection Transparency, Dark Surround': LLAB_InductionFactors(D=0.7, F_S=4, F_L=1, F_C=1), u'Cut Sheet Transparency, Dim Surround': LLAB_InductionFactors(D=1, F_S=5, F_L=1, F_C=1.1), u'ref_average_4_plus': LLAB_InductionFactors(D=1, F_S=3, F_L=0, F_C=1), u'Reference Samples & Images, Average Surround, Subtending < 4': LLAB_InductionFactors(D=1, F_S=3, F_L=1, F_C=1), u'Television & VDU Displays, Dim Surround': LLAB_InductionFactors(D=0.7, F_S=3.5, F_L=1, F_C=1), u'sheet_dim': LLAB_InductionFactors(D=1, F_S=5, F_L=1, F_C=1.1), u'projected_dark': LLAB_InductionFactors(D=0.7, F_S=4, F_L=1, F_C=1), u'ref_average_4_minus': LLAB_InductionFactors(D=1, F_S=3, F_L=1, F_C=1), u'Reference Samples & Images, Average Surround, Subtending > 4': LLAB_InductionFactors(D=1, F_S=3, F_L=0, F_C=1), u'tv_dim': LLAB_InductionFactors(D=0.7, F_S=3.5, F_L=1, F_C=1)})¶ Reference LLAB(l:c) colour appearance model viewing conditions.
- LLAB_VIEWING_CONDITIONS : CaseInsensitiveMapping
- {‘Reference Samples & Images, Average Surround, Subtending > 4’, ‘Reference Samples & Images, Average Surround, Subtending < 4’, ‘Television & VDU Displays, Dim Surround’, ‘Cut Sheet Transparency, Dim Surround’:, ‘35mm Projection Transparency, Dark Surround’}
Aliases:
- ‘ref_average_4_plus’: ‘Reference Samples & Images, Average Surround, Subtending > 4’
- ‘ref_average_4_minus’: ‘Reference Samples & Images, Average Surround, Subtending < 4’
- ‘tv_dim’: ‘Television & VDU Displays, Dim Surround’
- ‘sheet_dim’: ‘Cut Sheet Transparency, Dim Surround’
- ‘projected_dark’: ‘35mm Projection Transparency, Dark Surround’
-
colour.appearance.llab.
LLAB_XYZ_TO_RGB_MATRIX
= array([[ 0.8951, 0.2664, -0.1614], [-0.7502, 1.7135, 0.0367], [ 0.0389, -0.0685, 1.0296]])¶ LLAB(l:c) colour appearance model CIE XYZ tristimulus values to normalised cone responses matrix.
LLAB_XYZ_TO_RGB_MATRIX : array_like, (3, 3)
-
colour.appearance.llab.
LLAB_RGB_TO_XYZ_MATRIX
= array([[ 0.98699291, -0.14705426, 0.15996265], [ 0.43230527, 0.51836027, 0.04929123], [-0.00852866, 0.04004282, 0.9684867 ]])¶ LLAB(l:c) colour appearance model normalised cone responses to CIE XYZ tristimulus values matrix.
LLAB_RGB_TO_XYZ_MATRIX : array_like, (3, 3)
-
class
colour.appearance.llab.
LLAB_ReferenceSpecification
[source]¶ Bases:
colour.appearance.llab.LLAB_ReferenceSpecification
Defines the LLAB(l:c) colour appearance model reference specification.
This specification has field names consistent with Fairchild (2013) reference.
Parameters: - L_L (numeric or array_like) – Correlate of Lightness \(L_L\).
- Ch_L (numeric or array_like) – Correlate of chroma \(Ch_L\).
- h_L (numeric or array_like) – Hue angle \(h_L\) in degrees.
- s_L (numeric or array_like) – Correlate of saturation \(s_L\).
- C_L (numeric or array_like) – Correlate of colourfulness \(C_L\).
- HC (numeric or array_like) – Hue \(h\) composition \(H^C\).
- A_L (numeric or array_like) – Opponent signal \(A_L\).
- B_L (numeric or array_like) – Opponent signal \(B_L\).
-
class
colour.appearance.llab.
LLAB_Specification
[source]¶ Bases:
colour.appearance.llab.LLAB_Specification
Defines the LLAB(l:c) 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: - J (numeric or array_like) – Correlate of Lightness \(L_L\).
- C (numeric or array_like) – Correlate of chroma \(Ch_L\).
- h (numeric or array_like) – Hue angle \(h_L\) in degrees.
- s (numeric or array_like) – Correlate of saturation \(s_L\).
- M (numeric or array_like) – Correlate of colourfulness \(C_L\).
- HC (numeric or array_like) – Hue \(h\) composition \(H^C\).
- a (numeric or array_like) – Opponent signal \(A_L\).
- b (numeric or array_like) – Opponent signal \(B_L\).
Notes
- This specification is the one used in the current model implementation.
-
colour.appearance.llab.
XYZ_to_LLAB
(XYZ, XYZ_0, Y_b, L, surround=LLAB_InductionFactors(D=1, F_S=3, F_L=1, F_C=1))[source]¶ Computes the LLAB(l:c) colour appearance model correlates.
Parameters: - XYZ (array_like) – CIE XYZ tristimulus values of test sample / stimulus in domain [0, 100].
- XYZ_0 (array_like) – CIE XYZ tristimulus values of reference white in domain [0, 100].
- Y_b (numeric or array_like) – Luminance factor of the background in \(cd/m^2\).
- L (numeric or array_like) – Absolute luminance \(L\) of reference white in \(cd/m^2\).
- surround (LLAB_InductionFactors, optional) – Surround viewing conditions induction factors.
Returns: LLAB(l:c) colour appearance model specification.
Return type: Warning
The output range of that definition is non standard!
Notes
- Input CIE XYZ tristimulus values are in domain [0, 100].
- Input CIE XYZ_0 tristimulus values are in domain [0, 100].
Examples
>>> XYZ = np.array([19.01, 20.00, 21.78]) >>> XYZ_0 = np.array([95.05, 100.00, 108.88]) >>> Y_b = 20.0 >>> L = 318.31 >>> surround = LLAB_VIEWING_CONDITIONS['ref_average_4_minus'] >>> XYZ_to_LLAB(XYZ, XYZ_0, Y_b, L, surround) LLAB_Specification(J=37.3668650..., C=0.0089496..., h=270..., s=0.0002395..., M=0.0190185..., HC=None, a=..., b=-0.0190185...)
-
colour.appearance.llab.
XYZ_to_RGB_LLAB
(XYZ)[source]¶ Converts from CIE XYZ tristimulus values to normalised cone responses.
Parameters: XYZ (array_like) – CIE XYZ tristimulus values. Returns: Normalised cone responses. Return type: ndarray Examples
>>> XYZ = np.array([19.01, 20.00, 21.78]) >>> XYZ_to_RGB_LLAB(XYZ) array([ 0.9414279..., 1.0404012..., 1.0897088...])
-
colour.appearance.llab.
chromatic_adaptation
(RGB, RGB_0, RGB_0r, Y, D=1)[source]¶ Applies chromatic adaptation to given RGB normalised cone responses array.
Parameters: - RGB (array_like) – RGB normalised cone responses array of test sample / stimulus.
- RGB_0 (array_like) – RGB normalised cone responses array of reference white.
- RGB_0r (array_like) – RGB normalised cone responses array of reference illuminant CIE Standard Illuminant D Series D65.
- Y (numeric or array_like) – Tristimulus values \(Y\) of the stimulus.
- D (numeric or array_like, optional) – Discounting-the-Illuminant factor in domain [0, 1].
Returns: Adapted CIE XYZ tristimulus values.
Return type: ndarray
Examples
>>> RGB = np.array([0.94142795, 1.04040120, 1.08970885]) >>> RGB_0 = np.array([0.94146023, 1.04039386, 1.08950293]) >>> RGB_0r = np.array([0.94146023, 1.04039386, 1.08950293]) >>> Y = 20.0 >>> chromatic_adaptation(RGB, RGB_0, RGB_0r, Y) array([ 19.01, 20. , 21.78])
-
colour.appearance.llab.
f
(x, F_S)[source]¶ Defines the nonlinear response function of the LLAB(l:c) colour appearance model used to model the nonlinear behavior of various visual responses.
Parameters: - x (numeric or array_like or array_like) – Visual response variable \(x\).
- F_S (numeric or array_like) – Surround induction factor \(F_S\).
Returns: Modeled visual response variable \(x\).
Return type: numeric or array_like
Examples
>>> x = np.array([0.23350512, 0.23351103, 0.23355179]) >>> f(0.200009186234000, 3) array(0.5848125...)
-
colour.appearance.llab.
opponent_colour_dimensions
(XYZ, Y_b, F_S, F_L)[source]¶ Returns opponent colour dimensions from given adapted CIE XYZ tristimulus values.
The opponent colour dimensions are based on a modified CIE Lab colourspace formulae.
Parameters: - XYZ (array_like) – Adapted CIE XYZ tristimulus values.
- Y_b (numeric or array_like) – Luminance factor of the background in \(cd/m^2\).
- F_S (numeric or array_like) – Surround induction factor \(F_S\).
- F_L (numeric or array_like) – Lightness induction factor \(F_L\).
Returns: Opponent colour dimensions.
Return type: ndarray
Examples
>>> XYZ = np.array([19.00999572, 20.00091862, 21.77993863]) >>> Y_b = 20.0 >>> F_S = 3.0 >>> F_L = 1.0 >>> opponent_colour_dimensions(XYZ, Y_b, F_S, F_L) array([ 3.7368047...e+01, -4.4986443...e-03, -5.2604647...e-03])
-
colour.appearance.llab.
hue_angle
(a, b)[source]¶ Returns the hue angle \(h_L\) in degrees.
Parameters: - a (numeric or array_like) – Opponent colour dimension \(a\).
- b (numeric or array_like) – Opponent colour dimension \(b\).
Returns: Hue angle \(h_L\) in degrees.
Return type: numeric or ndarray
Examples
>>> hue_angle(-4.49864756e-03, -5.26046353e-03) 229.4635727...
-
colour.appearance.llab.
chroma_correlate
(a, b)[source]¶ Returns the correlate of chroma \(Ch_L\).
Parameters: - a (numeric or array_like) – Opponent colour dimension \(a\).
- b (numeric or array_like) – Opponent colour dimension \(b\).
Returns: Correlate of chroma \(Ch_L\).
Return type: numeric or ndarray
Examples
>>> a = -4.49864756e-03 >>> b = -5.26046353e-03 >>> chroma_correlate(a, b) 0.0086506...
-
colour.appearance.llab.
colourfulness_correlate
(L, L_L, Ch_L, F_C)[source]¶ Returns the correlate of colourfulness \(C_L\).
Parameters: - L (numeric or array_like) – Absolute luminance \(L\) of reference white in \(cd/m^2\).
- L_L (numeric or array_like) – Correlate of Lightness \(L_L\).
- Ch_L (numeric or array_like) – Correlate of chroma \(Ch_L\).
- F_C (numeric or array_like) – Chroma induction factor \(F_C\).
Returns: Correlate of colourfulness \(C_L\).
Return type: numeric or ndarray
Examples
>>> L = 318.31 >>> L_L = 37.368047493928195 >>> Ch_L = 0.008650662051714 >>> F_C = 1.0 >>> colourfulness_correlate(L, L_L, Ch_L, F_C) 0.0183832...
-
colour.appearance.llab.
saturation_correlate
(Ch_L, L_L)[source]¶ Returns the correlate of saturation \(S_L\).
Parameters: - Ch_L (numeric or array_like) – Correlate of chroma \(Ch_L\).
- L_L (numeric or array_like) – Correlate of Lightness \(L_L\).
Returns: Correlate of saturation \(S_L\).
Return type: numeric or ndarray
Examples
>>> Ch_L = 0.008650662051714 >>> L_L = 37.368047493928195 >>> saturation_correlate(Ch_L, L_L) 0.0002314...
-
colour.appearance.llab.
final_opponent_signals
(C_L, h_L)[source]¶ Returns the final opponent signals \(A_L\) and \(B_L\).
Parameters: - C_L (numeric or array_like) – Correlate of colourfulness \(C_L\).
- h_L (numeric or array_like) – Correlate of hue \(h_L\) in radians.
Returns: Final opponent signals \(A_L\) and \(B_L\).
Return type: ndarray
Examples
>>> C_L = 0.0183832899143 >>> h_L = 4.004894857014253 >>> final_opponent_signals(C_L, h_L) array([-0.0119478..., -0.0139711...])