CVBpy 14.1
cvb.spectral Namespace Reference

Common Vision Blox Spectral module for Python. More...

Classes

class  Cube
 Spectral Cube object. More...
 
class  CubeEncoding
 Defines how the mapping between a typical x-y image and samples-lines-bands is done. More...
 
class  CubeRange
 3D rectangle in the samples, lines and bands domain. More...
 
class  CubeType
 Defines the type of the cube. More...
 
class  FieldID
 Defines the field IDs to access fields in the metadata object. More...
 
class  FieldType
 Data type of a field. More...
 
class  InterpolationMethod
 Defines the interpolation method. More...
 
class  Interpolator
 Spectral Interpolator object. More...
 
class  MetaData
 Spectral MetaData object. More...
 
class  NormalizationMethod
 Defines the method used for normalizing the spectral cube with a white and a black reference. More...
 
class  PixelOverflow
 Defines how arithmetic overflows and underflows are handled. More...
 
class  StdIlluminant
 Defines Standard Illumination. More...
 
class  StdObserver
 Defines Standard Observer. More...
 
class  WrappedCube
 A wrapped cube (or linear non-owning cube) wraps another pixel buffer without owning it. More...
 

Functions

cvb.spectral.Cube add_cube (cvb.spectral.Cube cube1, cvb.spectral.Cube cube2, Optional[int] pixel_overflow)
 Element-wise addition of two cubes. More...
 
cvb.Image convert_cube_to_lab (cvb.spectral.Cube cube, cvb.spectral.Interpolator interpolator)
 Converts a normalized cube to a Lab image. More...
 
cvb.Image convert_cube_to_xyz (cvb.spectral.Cube cube, cvb.spectral.Interpolator interpolator)
 Converts a normalized cube to an XYZ image. More...
 
cvb.Image convert_lab_to_rgb8 (cvb.Image lab_image, cvb.spectral.Interpolator interpolator)
 Converts a Lab image to a sRGB 8bit image. More...
 
cvb.Image convert_xyz_to_lab (cvb.Image xyz_image, cvb.spectral.Interpolator interpolator)
 Converts an image from XYZ to Lab. More...
 
cvb.spectral.Cube divide_cube (cvb.spectral.Cube dividend, cvb.spectral.Cube divisor)
 Element-wise division of two cubes. More...
 
cvb.spectral.Cube multiply_cube (cvb.spectral.Cube cube1, cvb.spectral.Cube cube2, Optional[int] pixel_overflow)
 Element-wise multiplication of two cubes. More...
 
cvb.spectral.Cube normalize (cvb.spectral.Cube cube, cvb.spectral.Cube white_reference, cvb.spectral.Cube black_reference, int normalization_method)
 This function creates a normalized cube using the white- and black-reference and the object cube. More...
 
cvb.spectral.Cube subtract_cube (cvb.spectral.Cube minuend, cvb.spectral.Cube subtrahend, Optional[int] pixel_overflow)
 Element-wise subtraction of two cubes. More...
 

Detailed Description

Common Vision Blox Spectral module for Python.

Online Manual

Common Vision Blox-Tool Spectral

Function Documentation

◆ add_cube()

cvb.spectral.Cube add_cube ( cvb.spectral.Cube  cube1,
cvb.spectral.Cube  cube2,
Optional[int]  pixel_overflow 
)

Element-wise addition of two cubes.

Creates a new cube after adding all values of cube1 and cube2 for each element (cube1 + cube2).

Parameters

cube1 : cvb.spectral.Cube Any kind of cube is supported as long as the dimensions match with cube2.

cube2 : cvb.spectral.Cube Any kind of cube is supported as long as the dimensions match with cube1.

pixel_overflow : Optional[int] In case of cvb.spectral.PixelOverflow.Truncate: Clips the resulting pixel values to the maximum / minimum possible value of the resulting data type. In case of cvb.spectral.PixelOverflow.Unhandled (default): The result might lead to overflow (see cvb.spectral.PixelOverflow).

Returns

cvb.spectral.Cube Linear cube of the same dimensions and data type. The metadata is a copy from cube.

◆ convert_cube_to_lab()

cvb.Image convert_cube_to_lab ( cvb.spectral.Cube  cube,
cvb.spectral.Interpolator  interpolator 
)

Converts a normalized cube to a Lab image.

Parameters

cube : cvb.spectral.Cube Normalized linear cube with matching number of bands with the ones in the interpolator.

interpolator : cvb.spectral.Interpolator Contains the interpolated values of the relative spectral power distribution from color matching functions and standard illuminant.

Returns

cvb.Image 3-planed float32 image containing the values of Lab (L-value in plane=0, a-value in plane=1, b-value in plane=2).

◆ convert_cube_to_xyz()

cvb.Image convert_cube_to_xyz ( cvb.spectral.Cube  cube,
cvb.spectral.Interpolator  interpolator 
)

Converts a normalized cube to an XYZ image.

Parameters

cube : cvb.spectral.Cube Normalized linear cube with matching number of bands with the ones in the interpolator.

interpolator : cvb.spectral.Interpolator Contains the interpolated values of the relative spectral power distribution from color matching functions and standard illuminant.

Returns

cvb.Image 3-planed float32 image containing the values of XYZ (X-value in plane=0, Y-value in plane=1, Z-value in plane=2).

◆ convert_lab_to_rgb8()

cvb.Image convert_lab_to_rgb8 ( cvb.Image  lab_image,
cvb.spectral.Interpolator  interpolator 
)

Converts a Lab image to a sRGB 8bit image.

Parameters

lab_image : cvb.Image 3-planed image of data type float / double containing the Lab-values.

interpolator : cvb.spectral.Interpolator Contains the interpolated values of the relative spectral power distribution from color matching functions and standard illuminant.

Returns

cvb.Image 3-planed uint8 image containing the values of sRGB (R-value in plane=0, G-value in plane=1, B-value in plane=2).

◆ convert_xyz_to_lab()

cvb.Image convert_xyz_to_lab ( cvb.Image  xyz_image,
cvb.spectral.Interpolator  interpolator 
)

Converts an image from XYZ to Lab.

Parameters

xyz_image : cvb.Image 3-planed image of data type float / double containing the XYZ-values.

interpolator : cvb.spectral.Interpolator Contains the interpolated values of the relative spectral power distribution from color matching functions and standard illuminant.

Returns

cvb.Image 3-planed float32 image containing the values of Lab (L-value in plane=0, a-value in plane=1, b-value in plane=2).

◆ divide_cube()

cvb.spectral.Cube divide_cube ( cvb.spectral.Cube  dividend,
cvb.spectral.Cube  divisor 
)

Element-wise division of two cubes.

Creates a new cube after dividing all values of dividend and divisor for each element (dividend / divisor).

Parameters

dividend : cvb.spectral.Cube Any kind of cube is supported as long as the dimensions match with divisor.

divisor : cvb.spectral.Cube Any kind of cube is supported as long as the dimensions match with dividend.

Returns

cvb.spectral.Cube Linear cube of the same dimensions and data type. The metadata is a copy from dividend.

◆ multiply_cube()

cvb.spectral.Cube multiply_cube ( cvb.spectral.Cube  cube1,
cvb.spectral.Cube  cube2,
Optional[int]  pixel_overflow 
)

Element-wise multiplication of two cubes.

Creates a new cube after multiplying all values of cube1 and cube2 for each element (cube1 * cube2).

Parameters

cube1 : cvb.spectral.Cube Any kind of cube is supported as long as the dimensions match with cube2.

cube2 : cvb.spectral.Cube Any kind of cube is supported as long as the dimensions match with cube1.

pixel_overflow : Optional[int] In case of cvb.spectral.PixelOverflow.Truncate: Clips the resulting pixel values to the maximum/minimum possible value of the resulting data type. In case of cvb.spectral.PixelOverflow.Unhandled (default): The result might lead to overflow (see cvb.spectral.PixelOverflow).

Returns

cvb.spectral.Cube Linear cube of the same dimensions and data type. The metadata is a copy from cube.

◆ normalize()

cvb.spectral.Cube normalize ( cvb.spectral.Cube  cube,
cvb.spectral.Cube  white_reference,
cvb.spectral.Cube  black_reference,
int  normalization_method 
)

This function creates a normalized cube using the white- and black-reference and the object cube.

More details in cvb.spectral.NormalizationMethod. Note, that this function will throw an error for stacked cubes (cvb.spectral.CubeType.StackedCube). If you want to use this function anyhow, duplicate your cube with function cvb.spectral.Cube.clone to get a continous cube.

Parameters

cube : cvb.spectral.Cube Spectral Cube to work on.

white_reference : cvb.spectral.Cube The white reference contains a linear Cube with matching dimensions for samples and bands to cube.

black_reference : cvb.spectral.Cube The black reference contains a linear Cube with matching dimensions for samples and bands to cube.

normalization_method : int Defines the normalization method. More detailed information in cvb.spectral.NormalizationMethod (see cvb.spectral.NormalizationMethod); default: cvb.spectral.NormalizationMethod.AverageReferences1.

Returns

cvb.spectral.Cube Linear cube of the same dimensions and data type. The metadata is a copy from cube.

◆ subtract_cube()

cvb.spectral.Cube subtract_cube ( cvb.spectral.Cube  minuend,
cvb.spectral.Cube  subtrahend,
Optional[int]  pixel_overflow 
)

Element-wise subtraction of two cubes.

Creates a new cube after subtracting all values of minuend and subtrahend for each element (minuend - subtrahend).

Parameters

minuend : cvb.spectral.Cube Any kind of cube is supported as long as the dimensions match with subtrahend.

subtrahend : cvb.spectral.Cube Any kind of cube is supported as long as the dimensions match with minuend.

pixel_overflow : Optional[int] In case of cvb.spectral.PixelOverflow.Truncate: Clips the resulting pixel values to the maximum/minimum possible value of the resulting data type. In case of cvb.spectral.PixelOverflow.Unhandled (default): The result might lead to overflow (see cvb.spectral.PixelOverflow).

Returns

cvb.spectral.Cube Linear cube of the same dimensions and data type. The metadata is a copy from minuend.