colour.recovery.Dataset_Otsu2018¶
- class colour.recovery.Dataset_Otsu2018(shape: Optional[colour.colorimetry.spectrum.SpectralShape] = None, basis_functions: Optional[numpy.ndarray] = None, means: Optional[numpy.ndarray] = None, selector_array: Optional[numpy.ndarray] = None)[source]¶
Store 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 thecolour.recovery.Tree_Otsu2018.to_dataset()
method or alternatively, loaded from disk with thecolour.recovery.Dataset_Otsu2018.read()
method.- Parameters
shape (Optional[SpectralShape]) – Shape of the spectral data.
basis_functions (Optional[NDArray]) – Three basis functions for every cluster.
means (Optional[NDArray]) – Mean for every cluster.
selector_array (Optional[NDArray]) – 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
select()
cluster()
read()
write()
References
[OYH18]
Examples
>>> import os >>> import colour >>> from colour.characterisation import SDS_COLOURCHECKERS >>> from colour.colorimetry import sds_and_msds_to_msds >>> reflectances = sds_and_msds_to_msds( ... SDS_COLOURCHECKERS['ColorChecker N Ohta'].values() ... ) >>> node_tree = Tree_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: Optional[colour.colorimetry.spectrum.SpectralShape] = None, basis_functions: Optional[numpy.ndarray] = None, means: Optional[numpy.ndarray] = None, selector_array: Optional[numpy.ndarray] = None)[source]¶
- Parameters
shape (Optional[colour.colorimetry.spectrum.SpectralShape]) –
basis_functions (Optional[numpy.ndarray]) –
means (Optional[numpy.ndarray]) –
selector_array (Optional[numpy.ndarray]) –
Methods
__init__
([shape, basis_functions, means, ...])cluster
(xy)Return the basis functions and dataset mean for the given CIE xy coordinates.
read
(path)Read and loads a dataset from an .npz file.
select
(xy)Return the cluster index appropriate for the given CIE xy coordinates.
write
(path)Write 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.