colour.recovery.Dataset_Otsu2018

class colour.recovery.Dataset_Otsu2018(shape=None, basis_functions=None, means=None, selector_array=None)[source]

Stores all the information needed for the Otsu et al. (2018) spectral upsampling method.

Datasets can be either generated and converted as a colour.recovery.Dataset_Otsu2018 class instance using the colour.recovery.NodeTree_Otsu2018.to_dataset() method or alternatively, loaded from disk with the colour.recovery.Dataset_Otsu2018.read() method.

Parameters
  • shape (SpectralShape) – Shape of the spectral data.

  • basis_functions (array_like, (n, 3, m)) – Three basis functions for every cluster.

  • means (array_like, (n, m)) – Mean for every cluster.

  • selector_array (array_like, (k, 4)) – Array describing how to select the appropriate cluster. See colour.recovery.Dataset_Otsu2018.select() method for details.

Attributes

  • shape

  • basis_functions

  • means

  • selector_array

Methods

References

[]

Examples

>>> import os
>>> import colour
>>> from colour.characterisation import SDS_COLOURCHECKERS
>>> reflectances = [
...     sd.copy().align(SPECTRAL_SHAPE_OTSU2018).values
...     for sd in SDS_COLOURCHECKERS['ColorChecker N Ohta'].values()
... ]
>>> node_tree = NodeTree_Otsu2018(reflectances)
>>> node_tree.optimise(iterations=2, print_callable=lambda x: x)
>>> dataset = node_tree.to_dataset()
>>> path = os.path.join(colour.__path__[0], 'recovery', 'tests',
...                     'resources', 'ColorChecker_Otsu2018.npz')
>>> dataset.write(path) 
>>> dataset = Dataset_Otsu2018() 
>>> dataset.read(path) 
__init__(shape=None, basis_functions=None, means=None, selector_array=None)[source]

Methods

__init__([shape, basis_functions, means, ...])

cluster(xy)

Returns the basis functions and dataset mean for the given CIE xy coordinates.

read(path)

Reads and loads a dataset from an .npz file.

select(xy)

Returns the cluster index appropriate for the given CIE xy coordinates.

write(path)

Writes the dataset to an .npz file at given path.

Attributes

basis_functions

Getter property for the basis functions of the Otsu et al. (2018) dataset.

means

Getter property for means of the Otsu et al. (2018) dataset.

selector_array

Getter property for the selector array of the Otsu et al. (2018) dataset.

shape

Getter property for the shape used by the Otsu et al. (2018) dataset.