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.
- Parameters
*args (list, optional) – Sequence of colour.LUT1D, colour.LUT3x1D, colour.LUT3D or colour.io.lut.l.AbstractLUTSequenceOperator class instances.
Attributes
Methods
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)
- property sequence¶
Getter and setter property for the underlying LUT sequence.
- __getitem__(index)[source]¶
Returns the LUT sequence item at given index.
- Parameters
index (int) – LUT sequence item index.
- Returns
LUT sequence item at given index.
- Return type
LUT1D or LUT3x1D or LUT3D or AbstractLUTSequenceOperator
- __setitem__(index, value)[source]¶
Sets given the LUT sequence item at given index with given value.
- Parameters
index (int) – LUT sequence item index.
value (LUT1D or LUT3x1D or LUT3D or AbstractLUTSequenceOperator) – Value.
- __delitem__(index)[source]¶
Deletes the LUT sequence item at given index.
- Parameters
index (int) – LUT sequence item index.
- __hash__ = None¶
- __weakref__¶
list of weak references to the object (if defined)
- __len__()[source]¶
Returns the LUT sequence items count.
- Returns
LUT sequence items count.
- Return type
- __str__()[source]¶
Returns a formatted string representation of the LUT sequence.
- Returns
Formatted string representation.
- Return type
unicode
- __repr__()[source]¶
Returns an evaluable string representation of the LUT sequence.
- Returns
Evaluable string representation.
- Return type
unicode
- insert(index, LUT)[source]¶
Inserts given LUT at given index into the LUT sequence.
- Parameters
index (index) – Index to insert the LUT at into the LUT sequence.
LUT (LUT1D or LUT3x1D or LUT3D or AbstractLUTSequenceOperator) – LUT to insert into the LUT sequence.
- apply(RGB, interpolator_1D=<class 'colour.algebra.interpolation.LinearInterpolator'>, interpolator_1D_kwargs=None, interpolator_3D=<function table_interpolation_trilinear>, interpolator_3D_kwargs=None, **kwargs)[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
(andcolour.LUT3x1D
) class instances.interpolator_1D_kwargs (dict_like, optional) – Arguments to use when calling the interpolating function for
colour.LUT1D
(andcolour.LUT3x1D
) class instances.interpolator_3D (object, optional) – Interpolator object to use as interpolating function for
colour.LUT3D
class instances.interpolator_3D_kwargs (dict_like, optional) – Arguments to use when calling the interpolating function for
colour.LUT3D
class instances.**kwargs (dict, optional) – Keywords arguments for deprecation management.
- 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 ...]])