colour.table_interpolation

colour.table_interpolation(V_xyz, table, method='Trilinear')[source]

Performs interpolation of given \(V_{xyz}\) values using given interpolation table.

Parameters:
  • V_xyz (array_like) – \(V_{xyz}\) values to interpolate.
  • table (array_like) – 4-Dimensional (NxNxNx3) interpolation table.
  • method (unicode, optional) – {‘Trilinear’, ‘Tetrahedral’}, Interpolation method.
Returns:

Interpolated \(V_{xyz}\) values.

Return type:

ndarray

References

[Boub], [Kir06]

Examples

>>> import os
>>> import colour
>>> path = os.path.join(
...     os.path.dirname(__file__),'..', 'io', 'luts', 'tests', 'resources',
...     'iridas_cube', 'ColourCorrect.cube')
>>> LUT = colour.read_LUT(path)
>>> table = LUT.table
>>> prng = np.random.RandomState(4)
>>> V_xyz = colour.algebra.random_triplet_generator(3, random_state=prng)
>>> print(V_xyz)  # doctest: +ELLIPSIS
[[ 0.9670298...  0.7148159...  0.9762744...]
 [ 0.5472322...  0.6977288...  0.0062302...]
 [ 0.9726843...  0.2160895...  0.2529823...]]
>>> table_interpolation(V_xyz, table)  # doctest: +ELLIPSIS
array([[ 1.0120664...,  0.7539146...,  1.0228540...],
       [ 0.5075794...,  0.6479459...,  0.1066404...],
       [ 1.0976519...,  0.1785998...,  0.2299897...]])
>>> table_interpolation(V_xyz, table, method='Tetrahedral')
... # doctest: +ELLIPSIS
array([[ 1.0196197...,  0.7674062...,  1.0311751...],
       [ 0.5105603...,  0.6466722...,  0.1077296...],
       [ 1.1178206...,  0.1762039...,  0.2209534...]])