Colour Playground

A repository leveraging Binder to play with Colour.

In [1]:
from IPython.core.display import Image

Image(filename="resources/images/Colour_Logo_Medium_001.png")
Out[1]:

Introduction

In [2]:
from widgets import set_style

set_style()
Out[2]:

RGB Colourspace Models Transformation Matrix

Computes the colour transformation matrix between the given RGB Colourspace Models using the given Chromatic Adaptation Transform.

In [3]:
from widgets import RGB_colourspace_models_transformation_matrix_widget

RGB_colourspace_models_transformation_matrix_widget()

RGB Colourspace Models Chromatically Adapted Primaries

Computes the Chromatically Adapted Primaries of the given RGB Colourspace Model to the given Illuminant using the given Chromatic Adaptation Transform.

In [4]:
from widgets import RGB_colourspace_models_chromatically_adapted_primaries_widget

RGB_colourspace_models_chromatically_adapted_primaries_widget()

Chromatically Adapted XYZ to RGB Matrix

Computes the Chromatically Adapted XYZ to RGB Matrix of the given RGB Colourspace Model to the given Illuminant using the given Chromatic Adaptation Transform.

Notes: colour.XYZ_to_RGB_matrix andcolour.RGB_to_XYZ_matrix definitions are planned to be added to Colour to perform that computation directly.

In [5]:
import colour

input_colourspace = colour.RGB_COLOURSPACES['sRGB']
D50 = colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50']

M_CAT = colour.adaptation.chromatic_adaptation_matrix_VonKries(
        colour.xyY_to_XYZ(colour.xy_to_xyY(input_colourspace.whitepoint)),
        colour.xyY_to_XYZ(colour.xy_to_xyY(D50)),
        transform='CAT02')

colour.utilities.dot_matrix(input_colourspace.XYZ_to_RGB_matrix, M_CAT)
Out[5]:
array([[ 3.34502999, -1.43824292, -0.51857787],
       [-0.96856771,  1.84921036,  0.0432542 ],
       [ 0.05231262, -0.20627362,  0.80656844]])