colour.table_interpolation

colour.table_interpolation(V_xyz: ArrayLike, table: ArrayLike, method: Union[Literal['Trilinear', 'Tetrahedral'], str] = 'Trilinear') numpy.ndarray[source]

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

Parameters
  • V_xyz (ArrayLike) – \(V_{xyz}\) values to interpolate.

  • table (ArrayLike) – 4-Dimensional (NxNxNx3) interpolation table.

  • method (Union[Literal['Trilinear', 'Tetrahedral'], str]) – Interpolation method.

Returns

Interpolated \(V_{xyz}\) values.

Return type

numpy.ndarray

References

[Boub], [Kir06]

Examples

>>> import os
>>> import colour
>>> path = os.path.join(
...     os.path.dirname(__file__),'..', 'io', 'luts', 'tests', 'resources',
...     'iridas_cube', 'Colour_Correct.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)  
[[ 0.9670298...  0.7148159...  0.9762744...]
 [ 0.5472322...  0.6977288...  0.0062302...]
 [ 0.9726843...  0.2160895...  0.2529823...]]
>>> table_interpolation(V_xyz, table)  
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')
... 
array([[ 1.0196197...,  0.7674062...,  1.0311751...],
       [ 0.5105603...,  0.6466722...,  0.1077296...],
       [ 1.1178206...,  0.1762039...,  0.2209534...]])