colour.recovery.Dataset_Otsu2018#
- class colour.recovery.Dataset_Otsu2018(shape: SpectralShape | None = None, basis_functions: NDArrayFloat | None = None, means: NDArrayFloat | None = None, selector_array: NDArrayFloat | None = 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 (SpectralShape | None) – Shape of the spectral data.
basis_functions (NDArrayFloat | None) – Three basis functions for every cluster.
means (NDArrayFloat | None) – Mean for every cluster.
selector_array (NDArrayFloat | None) – 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: SpectralShape | None = None, basis_functions: NDArrayFloat | None = None, means: NDArrayFloat | None = None, selector_array: NDArrayFloat | None = None) None [source]#
- Parameters:
shape (SpectralShape | None)
basis_functions (NDArrayFloat | None)
means (NDArrayFloat | None)
selector_array (NDArrayFloat | None)
- Return type:
None
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.