colour.appearance.rlab Module¶
RLAB Colour Appearance Model¶
Defines RLAB colour appearance model objects:
References
[1] | Fairchild, M. D. (1996). Refinement of the RLAB color space. Color Research & Application, 21(5), 338–346. doi:10.1002/(SICI)1520-6378(199610)21:5<338::AID-COL3>3.0.CO;2-Z |
[2] | Fairchild, M. D. (2013). The RLAB Model. In Color Appearance Models (3rd ed., pp. 5563–5824). Wiley. ASIN:B00DAYO8E2 |
-
colour.appearance.rlab.
R_MATRIX
= array([[ 1.9569, -1.1882, 0.2313], [ 0.3612, 0.6388, 0. ], [ 0. , 0. , 1. ]])¶ RLAB colour appearance model precomputed helper matrix.
R_MATRIX : array_like, (3, 3)
-
colour.appearance.rlab.
RLAB_VIEWING_CONDITIONS
= CaseInsensitiveMapping({u'Dark': 0.2857142857142857, u'Dim': 0.3448275862068966, u'Average': 0.4347826086956522})¶ Reference RLAB colour appearance model viewing conditions.
- RLAB_VIEWING_CONDITIONS : CaseInsensitiveMapping
- {‘Average’, ‘Dim’, ‘Dark’}
-
colour.appearance.rlab.
RLAB_D_FACTOR
= CaseInsensitiveMapping({u'Soft Copy Images': 0, u'Projected Transparencies, Dark Room': 0.5, u'soft_cp_img': 0, u'Hard Copy Images': 1, u'projected_dark': 0.5, u'hard_cp_img': 1})¶ RLAB colour appearance model Discounting-the-Illuminant factor values.
- RLAB_D_FACTOR : CaseInsensitiveMapping
- {‘Hard Copy Images’, ‘Soft Copy Images’, ‘Projected Transparencies, Dark Room’}
Aliases:
- ‘hard_cp_img’: ‘Hard Copy Images’
- ‘soft_cp_img’: ‘Soft Copy Images’
- ‘projected_dark’: ‘Projected Transparencies, Dark Room’
-
class
colour.appearance.rlab.
RLAB_ReferenceSpecification
[source]¶ Bases:
colour.appearance.rlab.RLAB_ReferenceSpecification
Defines the RLAB colour appearance model reference specification.
This specification has field names consistent with Fairchild (2013) reference.
Parameters: - LR (numeric or array_like) – Correlate of Lightness \(L^R\).
- CR (numeric or array_like) – Correlate of achromatic chroma \(C^R\).
- hR (numeric or array_like) – Hue angle \(h^R\) in degrees.
- sR (numeric or array_like) – Correlate of saturation \(s^R\).
- HR (numeric or array_like) – Hue \(h\) composition \(H^R\).
- aR (numeric or array_like) – Red–green chromatic response \(a^R\).
- bR (numeric or array_like) – Yellow–blue chromatic response \(b^R\).
-
class
colour.appearance.rlab.
RLAB_Specification
[source]¶ Bases:
colour.appearance.rlab.RLAB_Specification
Defines the RLAB 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^R\).
- C (numeric or array_like) – Correlate of achromatic chroma \(C^R\).
- h (numeric or array_like) – Hue angle \(h^R\) in degrees.
- s (numeric or array_like) – Correlate of saturation \(s^R\).
- HC (numeric or array_like) – Hue \(h\) composition \(H^C\).
- a (numeric or array_like) – Red–green chromatic response \(a^R\).
- b (numeric or array_like) – Yellow–blue chromatic response \(b^R\).
Notes
- This specification is the one used in the current model implementation.
-
colour.appearance.rlab.
XYZ_to_RLAB
(XYZ, XYZ_n, Y_n, sigma=0.4347826086956522, D=1)[source]¶ Computes the RLAB model color appearance 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_n (numeric or array_like) – Absolute adapting luminance in \(cd/m^2\).
- sigma (numeric or array_like, optional) – Relative luminance of the surround, see
RLAB_VIEWING_CONDITIONS
for reference. - D (numeric or array_like, optional) – Discounting-the-Illuminant factor in domain [0, 1].
Returns: RLAB colour appearance model specification.
Return type: 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([109.85, 100, 35.58]) >>> Y_n = 31.83 >>> sigma = RLAB_VIEWING_CONDITIONS['Average'] >>> D = RLAB_D_FACTOR['Hard Copy Images'] >>> XYZ_to_RLAB(XYZ, XYZ_n, Y_n, sigma, D) RLAB_Specification(J=49.8347069..., C=54.8700585..., h=286.4860208..., s=1.1010410..., HC=None, a=15.5711021..., b=-52.6142956...)