colour.LUTSequence

class colour.LUTSequence(*args)[source]

Bases: collections.abc.MutableSequence

Defines the base class for a LUT sequence, i.e. a series of LUTs.

The colour.LUTSequence class can be used to model series of LUTs such as when a shaper LUT is combined with a 3D LUT.

Other Parameters

*args (list, optional) – Sequence of colour.LUT1D, colour.LUT3x1D, colour.LUT3D or colour.io.lut.l.AbstractLUTSequenceOperator class instances.

sequence
__getitem__()[source]
__setitem__()[source]
__delitem__()[source]
__len__()[source]
__str__()[source]
__repr__()[source]
__eq__()[source]
__ne__()[source]
insert()[source]
apply()[source]
copy()[source]

Examples

>>> LUT_1 = LUT1D()
>>> LUT_2 = LUT3D(size=3)
>>> LUT_3 = LUT3x1D()
>>> print(LUTSequence(LUT_1, LUT_2, LUT_3))
LUT Sequence
------------

Overview

    LUT1D ---> LUT3D ---> LUT3x1D

Operations

    LUT1D - Unity 10
    ----------------

    Dimensions : 1
    Domain     : [ 0.  1.]
    Size       : (10,)

    LUT3D - Unity 3
    ---------------

    Dimensions : 3
    Domain     : [[ 0.  0.  0.]
                  [ 1.  1.  1.]]
    Size       : (3, 3, 3, 3)

    LUT3x1D - Unity 10
    ------------------

    Dimensions : 2
    Domain     : [[ 0.  0.  0.]
                  [ 1.  1.  1.]]
    Size       : (10, 3)
apply(RGB, interpolator_1D=<class 'colour.algebra.interpolation.LinearInterpolator'>, interpolator_1D_args=None, interpolator_3D=<function table_interpolation_trilinear>, interpolator_3D_args=None)[source]

Applies the LUT sequence sequentially to given RGB colourspace array.

Parameters
  • RGB (array_like) – RGB colourspace array to apply the LUT sequence sequentially onto.

  • interpolator_1D (object, optional) – Interpolator object to use as interpolating function for colour.LUT1D (and colour.LUT3x1D) class instances.

  • interpolator_1D_args (dict_like, optional) – Arguments to use when calling the interpolating function for colour.LUT1D (and colour.LUT3x1D) class instances.

  • interpolator_3D (object, optional) – Interpolator object to use as interpolating function for colour.LUT3D class instances.

  • interpolator_3D_args (dict_like, optional) – Arguments to use when calling the interpolating function for colour.LUT3D class instances.

Returns

Processed RGB colourspace array.

Return type

ndarray

Examples

>>> LUT_1 = LUT1D(LUT1D.linear_table(16) + 0.125)
>>> LUT_2 = LUT3D(LUT3D.linear_table(16) ** (1 / 2.2))
>>> LUT_3 = LUT3x1D(LUT3x1D.linear_table(16) * 0.750)
>>> LUT_sequence = LUTSequence(LUT_1, LUT_2, LUT_3)
>>> samples = np.linspace(0, 1, 5)
>>> RGB = tstack([samples, samples, samples])
>>> LUT_sequence.apply(RGB)  
array([[ 0.2899886...,  0.2899886...,  0.2899886...],
       [ 0.4797662...,  0.4797662...,  0.4797662...],
       [ 0.6055328...,  0.6055328...,  0.6055328...],
       [ 0.7057779...,  0.7057779...,  0.7057779...],
       [ 0.75     ...,  0.75     ...,  0.75     ...]])
copy()[source]

Returns a copy of the LUT sequence.

Returns

LUT sequence copy.

Return type

LUTSequence

insert(index, LUT)[source]

Inserts given LUT at given index into the LUT sequence.

Parameters
property sequence

Getter and setter property for the underlying LUT sequence.

Parameters

value (list) – Value to set the the underlying LUT sequence with.

Returns

Underlying LUT sequence.

Return type

list