colour.recovery.Dataset_Otsu2018#
- class colour.recovery.Dataset_Otsu2018(shape: SpectralShape | None = None, basis_functions: TypeAliasForwardRef('NDArrayFloat') | None = None, means: TypeAliasForwardRef('NDArrayFloat') | None = None, selector_array: TypeAliasForwardRef('NDArrayFloat') | None = None)[source]#
Store all information required for the Otsu et al. (2018) spectral upsampling method.
Datasets can be generated and converted as a
colour.recovery.Dataset_Otsu2018class instance using thecolour.recovery.Tree_Otsu2018.to_dataset()method or 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 the
colour.recovery.Dataset_Otsu2018.select()method for details.
Attributes
shapebasis_functionsmeansselector_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: TypeAliasForwardRef('NDArrayFloat') | None = None, means: TypeAliasForwardRef('NDArrayFloat') | None = None, selector_array: TypeAliasForwardRef('NDArrayFloat') | None = None) None[source]#
- Parameters:
shape (SpectralShape | None)
basis_functions (TypeAliasForwardRef('NDArrayFloat') | None)
means (TypeAliasForwardRef('NDArrayFloat') | None)
selector_array (TypeAliasForwardRef('NDArrayFloat') | None)
- Return type:
None
Methods
__init__([shape, basis_functions, means, ...])cluster(xy)Retrieve the basis functions and dataset mean for the specified CIE xy chromaticity coordinates.
read(path)Read and load a dataset from an .npz file.
select(xy)Select the cluster index for the specified CIE xy chromaticity coordinates.
write(path)Write the dataset to an .npz file at the specified path.
Attributes
basis_functionsGetter for the basis functions of the Otsu et al. (2018) dataset.
meansGetter for the means of the Otsu et al. (2018) dataset.
selector_arrayGetter for the selector array of the Otsu et al. (2018) dataset.
shapeGetter for the spectral shape of the Otsu et al. (2018) dataset.