# Color Appearance Models¶

Color appearance models allow the prediction of perceptual correlates (e.g., lightness, chroma or hue) of a given surface color under certain viewing conditions (e.g., a certain illuminant, surround or background). The complexity of color appearance models can range from very low, e.g., CIELAB can technically be considered a color appearance model, to very complex models that take into account a large number color appearance phenomena.

Each of the classes in this module represents a specific model and its computation, yielding the predicted perceptual correlates as instance attributes. Discussing the details of each model go beyond this documentation, but we provide references to the relevant literature for each model and would advice familiarising yourself with it, before using a given models.

## Example¶

# Color stimulus
color = XYZColor(19.01, 20, 21.78)

# The two illuminants that will be compared.
illuminant_d65 = XYZColor(95.05, 100, 108.88)
illuminant_a = XYZColor(109.85, 100, 35.58)

# Background relative luminance
y_b = 20

l_a = 328.31

# Surround condition assumed to be average (see CIECAM02 documentation for values)
c = 0.69
n_c = 1
f = 1

model = CIECAM02(color.xyz_x, color.xyz_y, color.xyz_z,
illuminant_d65.xyz_x, illuminant_d65.xyz_y, illuminant_d65.xyz_z,
y_b, l_a, c, n_c, f)


## Nayatani95 et al. Model¶

class colormath.color_appearance_models.Nayatani95(x, y, z, x_n, y_n, z_n, y_ob, e_o, e_or, n=1)[source]

Bases: object

References

• Fairchild, M. D. (2013). Color appearance models, 3rd Ed. John Wiley & Sons.
• 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.
Parameters: x – X value of test sample $$X$$. y – Y value of test sample $$Y$$. z – Z value of test sample $$Z$$. x_n – X value of reference white $$X_n$$. y_n – Y value of reference white $$Y_n$$. z_n – Z value of reference white $$Z_n$$. y_ob – Luminance factor of achromatic background as percentage $$Y_o$$. Required to be larger than 0.18. e_o – Illuminance of the viewing field $$E_o$$ in lux. e_or – Normalising illuminance $$E_or$$ in lux. n – Noise term $$n$$.
brightness

Predicted brightness $$B_r$$.

chroma

Predicted chroma $$C$$.

colorfulness

Predicted colorfulness $$M$$.

hue_angle

Predicted hue angle $$\theta$$.

saturation

Predicted saturation $$S$$.

## Hunt Model¶

class colormath.color_appearance_models.Hunt(x, y, z, x_b, y_b, z_b, x_w, y_w, z_w, l_a, n_c, n_b, l_as=None, cct_w=None, n_cb=None, n_bb=None, x_p=None, y_p=None, z_p=None, p=None, helson_judd=False, discount_illuminant=True, s=None, s_w=None)[source]

Bases: object

References

• Fairchild, M. D. (2013). Color appearance models, 3rd Ed. John Wiley & Sons.
• Hunt, R. W. G. (2005). The reproduction of colour. 5th Ed., John Wiley & Sons.
Parameters: x – X value of test sample $$X$$. y – Y value of test sample $$Y$$. z – Z value of test sample $$Z$$. x_b – X value of background $$X_b$$. y_b – Y value of background $$Y_b$$. z_b – Z value of background $$Z_b$$. x_w – X value of reference white $$X_W$$. y_w – Y value of reference white $$Y_W$$. z_w – Z value of reference white $$Z_W$$. l_a – Adapting luminance $$L_A$$. n_c – Chromatic surround induction_factor $$N_c$$. n_b – Brightness surround induction factor $$N_b$$. l_as – Scotopic luminance of the illuminant $$L_{AS}$$. Will be approximated if not supplied. cct_w – Correlated color temperature of illuminant $$T$$. Will be used to approximate l_as if not supplied. n_cb – Chromatic background induction factor $$N_{cb}$$. Will be approximated using y_w and y_b if not supplied. n_bb – Brightness background induction factor $$N_{bb}$$. Will be approximated using y_w and y_b if not supplied. x_p – X value of proxima field $$X_p$$. If not supplied, will be assumed to equal background. y_p – Y value of proxima field $$Y_p$$. If not supplied, will be assumed to equal background. z_p – Z value of proxima field $$Z_p$$. If not supplied, will be assumed to equal background. p – Simultaneous contrast/assimilation parameter. helson_judd – Truth value indicating whether the Heslon-Judd effect should be accounted for. Default False. discount_illuminant – Truth value whether discount-the-illuminant should be applied. Default True. s – Scotopic response to the stimulus. s_w – Scotopic response for th reference white. ValueError – if illegal parameter combination is supplied.
brightness

Predicted brightness $$Q$$.

chroma

Predicted chroma $$C_{94}$$.

colorfulness

Predicted colorfulness $$M_{94}$$.

hue_angle

Predicted hue angle $$h_s$$.

lightness

Predicted colorfulness $$J$$.

saturation

Predicted saturation $$s$$.

## RLAB Model¶

class colormath.color_appearance_models.RLAB(x, y, z, x_n, y_n, z_n, y_n_abs, sigma, d)[source]

Bases: object

References

• Fairchild, M. D. (1996). Refinement of the RLAB color space. Color Research & Application, 21(5), 338-346.
• Fairchild, M. D. (2013). Color appearance models, 3rd Ed. John Wiley & Sons.
Parameters: x – X value of test sample $$X$$. y – Y value of test sample $$Y$$. z – Z value of test sample $$Z$$. x_n – X value of reference white $$X_n$$. y_n – Y value of reference white $$Y_n$$. z_n – Z value of reference white $$Z_n$$. y_n_abs – Absolute luminance $$Y_n$$ of a white object in cd/m^2. sigma – Relative luminance parameter $$\sigma$$. For average surround set $$\sigma=1/2.3$$, for dim surround $$\sigma=1/2.9$$ and for dark surround $$\sigma=1/3.5$$. d – Degree of adaptation $$D$$.
a

Predicted red-green chromatic response $$a^R$$.

b

Predicted yellow-blue chromatic response $$b^R$$.

chroma

Predicted chroma $$C^R$$.

hue_angle

Predicted hue angle $$h^R$$.

lightness

Predicted colorfulness $$L^R$$.

saturation

Predicted saturation $$s^R$$.

## ATD95 Model¶

class colormath.color_appearance_models.ATD95(x, y, z, x_0, y_0, z_0, y_0_abs, k_1, k_2, sigma=300)[source]

Bases: object

References

• Fairchild, M. D. (2013). Color appearance models, 3rd Ed. John Wiley & Sons.
• Guth, S. L. (1995, April). Further applications of the ATD model for color vision. In IS&T/SPIE’s Symposium on Electronic Imaging: Science & Technology (pp. 12-26). International Society for Optics and Photonics.
Parameters: x – X value of test sample $$X$$. y – Y value of test sample $$Y$$. z – Z value of test sample $$Z$$. x_0 – X value of reference white $$X_0$$. y_0 – Y value of reference white $$Y_0$$. z_0 – Z value of reference white $$Z_0$$. y_0_abs – Absolute adapting luminance $$Y_0$$ in cd/m^2. k_1 – $$k_1$$ k_2 – $$k_2$$ sigma – $$\sigma$$
brightness

Predicted brightness $$Br$$.

hue

Predicted hue $$H$$.

saturation

Predicted saturation $$C$$.

## LLAB Model¶

class colormath.color_appearance_models.LLAB(x, y, z, x_0, y_0, z_0, y_b, f_s, f_l, f_c, l, d=1)[source]

Bases: object

References

• Fairchild, M. D. (2013). Color appearance models, 3rd Ed. John Wiley & Sons.
• Luo, M. R., & Morovic, J. (1996, September). Two unsolved issues in colour management-colour appearance and gamut mapping. In 5th International Conference on High Technology (pp. 136-147).
• Luo, M. R., Lo, M. C., & Kuo, W. G. (1996). The LLAB (l: c) colour model. Color Research & Application, 21(6), 412-429.
Parameters: x – X value of test sample $$X$$. y – Y value of test sample $$Y$$. z – Z value of test sample $$Z$$. x_0 – X value of reference white $$X_0$$. y_0 – Y value of reference white $$Y_0$$. z_0 – Z value of reference white $$Z_0$$. y_b – Luminance factor of the background $$Y_b$$ in cd/m^2. f_s – Surround induction factor $$F_S$$. f_l – Lightness induction factor $$F_L$$. f_c – Chroma induction factor $$F_C$$. l – Absolute luminance of reference white $$L$$ in cd/m^2. d – Discounting-the-Illuminant factor $$D$$.
a_l

Predicted red-green chromatic response $$A_L$$.

b_l

Predicted yellow-blue chromatic response $$B_L$$.

chroma

Predicted chroma $$Ch_L$$.

hue_angle

Predicted hue angle $$h_L$$.

lightness

Predicted colorfulness $$L_L$$.

saturation

Predicted saturation $$s_L$$.

## CIECAM02 Model¶

class colormath.color_appearance_models.CIECAM02(x, y, z, x_w, y_w, z_w, y_b, l_a, c, n_c, f, d=False)[source]

Bases: object

References

• CIE TC 8-01 (2004). A Color appearance model for color management systems. Publication 159. Vienna: CIE Central Bureau. ISBN 3-901906-29-0.
• Fairchild, M. D. (2013). Color appearance models, 3rd Ed. John Wiley & Sons.
Parameters: x – X value of test sample $$X$$. y – Y value of test sample $$Y$$. z – Z value of test sample $$Z$$. x_w – X value of reference white $$X_W$$. y_w – Y value of reference white $$Y_W$$. z_w – Z value of reference white $$Z_W$$. y_b – Background relative luminance $$Y_b$$. l_a – Adapting luminance $$L_A$$ in cd/m^2. c – Exponential nonlinearity $$c$$. (Average/Dim/Dark) (0.69/0.59/0.525). n_c – Chromatic induction factor $$N_c$$. (Average/Dim/Dark) (1.0,0.9,0.8). f – Maximum degree of adaptation $$F$$. (Average/Dim/Dark) (1.0/0.9/0.8). d – Discount-the-Illuminant factor $$D$$.
a

Predicted red-green chromatic response $$a$$.

b

Predicted yellow-blue chromatic response $$b$$.

brightness

Predicted colorfulness $$Q$$.

chroma

Predicted chroma $$C$$.

colorfulness

Predicted colorfulness $$M$$.

hue_angle

Predicted hue angle $$h$$.

lightness

Predicted colorfulness $$J$$.

saturation

Predicted saturation $$s_L$$.

## CIECAM02-m1 Model¶

class colormath.color_appearance_models.CIECAM02m1(x, y, z, x_w, y_w, z_w, x_b, y_b, z_b, l_a, c, n_c, f, p, d=False)[source]

References

• Wu, R. C., & Wardman, R. H. (2007). Proposed modification to the CIECAM02 colour appearance model to include the simultaneous contrast effects. Color Research & Application, 32(2), 121-129.
Parameters: x – X value of test sample $$X$$. y – Y value of test sample $$Y$$. z – Z value of test sample $$Z$$. x_w – X value of reference white $$X_W$$. y_w – Y value of reference white $$Y_W$$. z_w – Z value of reference white $$Z_W$$. x_b – X value of background $$X_b$$. y_b – Y value of background $$Y_b$$. z_b – Z value of background $$Z_b$$. l_a – Adapting luminance $$L_A$$ in cd/m^2. c – Exponential nonlinearity $$c$$. (Average/Dim/Dark) (0.69/0.59/5.25). n_c – Chromatic induction factor $$N_c$$. (Average/Dim/Dark) (1.0,0.9,0.8). f – Maximum degree of adaptation $$F$$. (Average/Dim/Dark) (1.0/0.9/0.8). p – Simultaneous contrast/assimilation parameter. d – Discount-the-Illuminant factor $$D$$.
a

Predicted red-green chromatic response $$a$$.

b

Predicted yellow-blue chromatic response $$b$$.

brightness

Predicted colorfulness $$Q$$.

chroma

Predicted chroma $$C$$.

colorfulness

Predicted colorfulness $$M$$.

hue_angle

Predicted hue angle $$h$$.

lightness

Predicted colorfulness $$J$$.

saturation

Predicted saturation $$s_L$$.