colour.LUT1D

class colour.LUT1D(table=None, name=None, domain=None, size=10, comments=None)[source]

Defines the base class for a 1D LUT.

Parameters
  • table (array_like, optional) – Underlying LUT table.

  • name (unicode, optional) – LUT name.

  • domain (unicode, optional) – LUT domain, also used to define the instantiation time default table domain.

  • size (int, optional) – Size of the instantiation time default table.

  • comments (array_like, optional) – Comments to add to the LUT.

is_domain_explicit()[source]
linear_table()[source]
apply()[source]
as_LUT()[source]

Examples

Instantiating a unity LUT with a table with 16 elements:

>>> print(LUT1D(size=16))
LUT1D - Unity 16
----------------

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

Instantiating a LUT using a custom table with 16 elements:

>>> print(LUT1D(LUT1D.linear_table(16) ** (1 / 2.2)))  
LUT1D - ...
--------...

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

Instantiating a LUT using a custom table with 16 elements, custom name, custom domain and comments:

>>> from colour.algebra import spow
>>> domain = np.array([-0.1, 1.5])
>>> print(LUT1D(
...     spow(LUT1D.linear_table(16, domain), 1 / 2.2),
...     'My LUT',
...     domain,
...     comments=['A first comment.', 'A second comment.']))
LUT1D - My LUT
--------------

Dimensions : 1
Domain     : [-0.1  1.5]
Size       : (16,)
Comment 01 : A first comment.
Comment 02 : A second comment.
__init__(table=None, name=None, domain=None, size=10, comments=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([table, name, domain, size, comments])

Initialize self.

apply(RGB[, interpolator, interpolator_args])

Applies the LUT to given RGB colourspace array using given method.

arithmetical_operation(a, operation[, in_place])

Performs given arithmetical operation with \(a\) operand, the operation can be either performed on a copy or in-place, must be reimplemented by sub-classes.

as_LUT(cls[, force_conversion])

Converts the LUT to given cls class instance.

copy()

Returns a copy of the sub-class instance.

is_domain_explicit()

Returns whether the LUT domain is explicit (or implicit).

linear_table([size, domain])

Returns a linear table, the number of output samples \(n\) is equal to size.

Attributes

comments

Getter and setter property for the LUT comments.

dimensions

Getter and setter property for the LUT dimensions.

domain

Getter and setter property for the LUT domain.

name

Getter and setter property for the LUT name.

size

Getter property for the LUT size.

table

Getter and setter property for the underlying LUT table.