IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
ColorMatrixTransformationModule Class Reference
Inheritance diagram for ColorMatrixTransformationModule:

Public Member Functions

None __init__ (self)
 Initialize a color matrix transformation module with default settings.
 
None __del__ (self)
 
str type (self)
 Returns the type of the module for serialization purposes.
 
int version (self)
 Return the module version.
 
bool enabled (self)
 Gets whether this module is enabled.
 
None enabled (self, bool enabled)
 Enables or disables the module.
 
np.ndarray matrix (self)
 Gets the current color correction matrix.
 
None matrix (self, np.ndarray matrix)
 Sets the color correction matrix.
 
float saturation (self)
 Gets the current saturation value.
 
None saturation (self, float saturation)
 Sets the saturation value.
 
Interval saturation_range (self)
 Gets the valid range for saturation.
 
bool color_correction_enabled (self)
 Gets whether color correction is enabled.
 
None color_correction_enabled (self, bool enabled)
 Enables or disables color correction.
 
bool chromatic_adaption_enabled (self)
 Checks if the chromatic adaptation feature is enabled.
 
None chromatic_adaption_enabled (self, bool enabled)
 Enables or disables the chromatic adaptation feature.
 
ChromaticAdaptionAlgorithm chromatic_adaption_algorithm (self)
 Returns the current algorithm used for chromatic adaptation.
 
None chromatic_adaption_algorithm (self, ChromaticAdaptionAlgorithm algorithm)
 Sets the algorithm used to calculate the chromatic adaptation transformation.
 
ColorSpace target_color_space (self)
 Returns the target color space used for chromatic adaptation.
 
None target_color_space (self, ColorSpace color_space)
 Sets the target color space for the chromatic adaptation transformation.
 
int color_temperature (self)
 Returns the currently configured source color temperature in Kelvin.
 
None color_temperature (self, int temperature)
 Sets the source color temperature in Kelvin to be used for chromatic adaptation.
 
Range color_temperature_range (self)
 Returns the valid range of values for color temperature.
 
bool has_color_temperature (self)
 Checks if a specific color temperature has been explicitly set.
 
None reset_color_temperature (self)
 Resets the color temperature to its default, uninitialized state.
 
None reset_chromatic_adaption (self)
 Resets all chromatic adaptation settings (temperature, algorithm, color space) to their default values.
 
bool saturation_enabled (self)
 Gets whether saturation is enabled.
 
None saturation_enabled (self, bool enabled)
 Enables or disables saturation.
 
Image process (self, Image input_image)
 Processes the input image and returns a color corrected and/or saturated output image.
 
None reset_to_default (self)
 Resets all settings to their defaults.
 
None serialize (self, IArchive archive)
 Serializes the object's internal state into the provided archive.
 
None deserialize (self, IArchive archive)
 Restores the object's state from the provided archive.
 
np.ndarray effective_matrix (self)
 Returns the final effective matrix calculated by concatenating all enabled transformations (e.g., Chromatic Adaptation, Color Correction, and Saturation).
 

Data Fields

bool color_correction_enabled = enabled
 
bool saturation_enabled = enabled
 
bool chromatic_adaption_enabled = enabled
 
 chromatic_adaption_algorithm = ChromaticAdaptionAlgorithm.BRADFORD
 
 target_color_space = ColorSpace.SRGB_D65
 
 enabled
 
np matrix = self.DEFAULT_MATRIX
 
float saturation = self.DEFAULT_SATURATION
 
 version
 
 color_temperature
 
np.ndarray _auto_feature_module = self.effective_matrix
 

Static Public Attributes

np DEFAULT_MATRIX = np.eye(3)
 
float DEFAULT_SATURATION = 1.0
 
list SUPPORTED_PIXEL_FORMATS
 

Protected Member Functions

None _set_autofeature_module (self, IAutoFeature|None auto_feature_module)
 
None _update_matrix_in_auto_feature_module (self)
 

Protected Attributes

 _handle = _color_matrix_transformation_handle
 
IAutoFeature|None _auto_feature_module = None
 

Detailed Description

Color matrix transformation is an image pipeline module that applies a color correction matrix to an image.

Provides the features ColorCorrectionFeature, SaturationFeature and ChromaticAdaptionFeature.

Default configuration:

  • Color correction matrix = 3x3 identity matrix
  • Saturation = 1.0
  • no chromatic adaption correction applied
Since
ids_peak_icv 1.0

Definition at line 19 of file color_matrix_transformation_module.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self)

Initialize a color matrix transformation module with default settings.

Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 56 of file color_matrix_transformation_module.py.

◆ __del__()

None __del__ ( self)

Definition at line 75 of file color_matrix_transformation_module.py.

Member Function Documentation

◆ _set_autofeature_module()

None _set_autofeature_module ( self,
IAutoFeature | None auto_feature_module )
protected

Definition at line 639 of file color_matrix_transformation_module.py.

◆ _update_matrix_in_auto_feature_module()

None _update_matrix_in_auto_feature_module ( self)
protected

Definition at line 661 of file color_matrix_transformation_module.py.

◆ chromatic_adaption_algorithm() [1/2]

ChromaticAdaptionAlgorithm chromatic_adaption_algorithm ( self)

Returns the current algorithm used for chromatic adaptation.

Returns
The active ChromaticAdaptionAlgorithm.
Since
ids_peak_icv 1.3

Definition at line 303 of file color_matrix_transformation_module.py.

◆ chromatic_adaption_algorithm() [2/2]

None chromatic_adaption_algorithm ( self,
ChromaticAdaptionAlgorithm algorithm )

Sets the algorithm used to calculate the chromatic adaptation transformation.

Parameters
algorithmThe ChromaticAdaptionAlgorithm to apply.
Since
ids_peak_icv 1.3

Definition at line 321 of file color_matrix_transformation_module.py.

◆ chromatic_adaption_enabled() [1/2]

bool chromatic_adaption_enabled ( self)

Checks if the chromatic adaptation feature is enabled.

Returns
True if chromatic adaptation is currently active, false otherwise.
Since
ids_peak_icv 1.3

Definition at line 267 of file color_matrix_transformation_module.py.

◆ chromatic_adaption_enabled() [2/2]

None chromatic_adaption_enabled ( self,
bool enabled )

Enables or disables the chromatic adaptation feature.

Parameters
enabledTrue to enable chromatic adaptation, false to disable it.
Since
ids_peak_icv 1.3

Definition at line 286 of file color_matrix_transformation_module.py.

◆ color_correction_enabled() [1/2]

bool color_correction_enabled ( self)

Gets whether color correction is enabled.

When enabled, :func:process applies color correction to the input image.

Returns
True if color correction is enabled, False otherwise.
Since
ids_peak_icv 1.0

Definition at line 227 of file color_matrix_transformation_module.py.

◆ color_correction_enabled() [2/2]

None color_correction_enabled ( self,
bool enabled )

Enables or disables color correction.

When enabled, :func:process applies color correction to the input image.

Parameters
enabledTrue to enable, False to disable.
Since
ids_peak_icv 1.0

Definition at line 248 of file color_matrix_transformation_module.py.

◆ color_temperature() [1/2]

int color_temperature ( self)

Returns the currently configured source color temperature in Kelvin.

Returns
The color temperature value in Kelvin.
Since
ids_peak_icv 1.3

Definition at line 373 of file color_matrix_transformation_module.py.

◆ color_temperature() [2/2]

None color_temperature ( self,
int temperature )

Sets the source color temperature in Kelvin to be used for chromatic adaptation.

Parameters
temperatureThe color temperature value in Kelvin.
Since
ids_peak_icv 1.3

Definition at line 391 of file color_matrix_transformation_module.py.

◆ color_temperature_range()

Range color_temperature_range ( self)

Returns the valid range of values for color temperature.

Returns
A Range denoting the min and max allowed temperature values as well as its allowed increment.
Since
ids_peak_icv 1.3

Definition at line 408 of file color_matrix_transformation_module.py.

◆ deserialize()

None deserialize ( self,
IArchive archive )

Restores the object's state from the provided archive.

This function reads and applies all necessary parameters from the given archive to reconstruct the internal state of the object. It ensures that the object is restored to a valid and consistent state.

Parameters
archiveThe source archive containing the serialized parameters.
Exceptions
CorruptedExceptionIf Archive is malformed, misses keys or the values are invalid
NotSupportedExceptionIf the 'Version' entry indicates an unsupported version.
Note
This function requires that the archive contains all expected fields as produced by a corresponding serialize() call.
Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 593 of file color_matrix_transformation_module.py.

◆ effective_matrix()

np.ndarray effective_matrix ( self)

Returns the final effective matrix calculated by concatenating all enabled transformations (e.g., Chromatic Adaptation, Color Correction, and Saturation).

Returns
The combined effective color correction matrix.
Since
ids_peak_icv 1.3

Definition at line 644 of file color_matrix_transformation_module.py.

◆ enabled() [1/2]

bool enabled ( self)

Gets whether this module is enabled.

When disabled, :func:process returns the input image unchanged.

Returns
True if the module is enabled, False otherwise.
Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 104 of file color_matrix_transformation_module.py.

◆ enabled() [2/2]

None enabled ( self,
bool enabled )

Enables or disables the module.

When disabled, :func:process returns the input image unchanged.

Parameters
enabledTrue to enable, False to disable.
Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 118 of file color_matrix_transformation_module.py.

◆ has_color_temperature()

bool has_color_temperature ( self)

Checks if a specific color temperature has been explicitly set.

Returns
True if a color temperature is configured, false otherwise.
Since
ids_peak_icv 1.3

Definition at line 425 of file color_matrix_transformation_module.py.

◆ matrix() [1/2]

np.ndarray matrix ( self)

Gets the current color correction matrix.

Returns
The current color correction matrix.
Since
ids_peak_icv 1.0

Definition at line 135 of file color_matrix_transformation_module.py.

◆ matrix() [2/2]

None matrix ( self,
np.ndarray matrix )

Sets the color correction matrix.

Parameters
matrixThe color correction matrix.
Since
ids_peak_icv 1.0

Definition at line 157 of file color_matrix_transformation_module.py.

◆ process()

Image process ( self,
Image input_image )

Processes the input image and returns a color corrected and/or saturated output image.

Supported pixel formats
  • BGR8
  • BGRa8
  • RGB8
  • RGBa8
  • BGR10
  • BGRa10
  • RGB10
  • RGBa10
  • BGR12
  • BGRa12
  • RGB12
  • RGBa12

See the Pixel and Pixel Format Specifications for a detailed description of the pixel formats.

Images with other formats are passed through unmodified.

Note
This operation disregards any specified image regions and processes the entire image.
Parameters
input_imageThe input image to be processed.
Returns
The input image after in-place color correction and/or saturation has been applied.
Since
ids_peak_icv 1.0

Definition at line 506 of file color_matrix_transformation_module.py.

◆ reset_chromatic_adaption()

None reset_chromatic_adaption ( self)

Resets all chromatic adaptation settings (temperature, algorithm, color space) to their default values.

Since
ids_peak_icv 1.3

Definition at line 455 of file color_matrix_transformation_module.py.

◆ reset_color_temperature()

None reset_color_temperature ( self)

Resets the color temperature to its default, uninitialized state.

Since
ids_peak_icv 1.3

Definition at line 442 of file color_matrix_transformation_module.py.

◆ reset_to_default()

None reset_to_default ( self)

Resets all settings to their defaults.

Default configuration:

  • matrix = identity
  • saturation = 1.0
  • no chromatic adaption correction
Note
The enabled state does not change when calling this function.
Since
ids_peak_icv 1.0

Definition at line 536 of file color_matrix_transformation_module.py.

◆ saturation() [1/2]

float saturation ( self)

Gets the current saturation value.

Returns
The current saturation value.
Since
ids_peak_icv 1.0

Definition at line 177 of file color_matrix_transformation_module.py.

◆ saturation() [2/2]

None saturation ( self,
float saturation )

Sets the saturation value.

Parameters
saturationThe saturation value.
Since
ids_peak_icv 1.0

Definition at line 194 of file color_matrix_transformation_module.py.

◆ saturation_enabled() [1/2]

bool saturation_enabled ( self)

Gets whether saturation is enabled.

When enabled, :func:process applies saturation to the input image.

Returns
True if saturation is enabled, False otherwise.
Since
ids_peak_icv 1.0

Definition at line 467 of file color_matrix_transformation_module.py.

◆ saturation_enabled() [2/2]

None saturation_enabled ( self,
bool enabled )

Enables or disables saturation.

When enabled, :func:process applies saturation to the input image.

Parameters
enabledTrue to enable, False to disable.
Since
ids_peak_icv 1.0

Definition at line 488 of file color_matrix_transformation_module.py.

◆ saturation_range()

Interval saturation_range ( self)

Gets the valid range for saturation.

Returns
The valid saturation range.
Since
ids_peak_icv 1.0

Definition at line 211 of file color_matrix_transformation_module.py.

◆ serialize()

None serialize ( self,
IArchive archive )

Serializes the object's internal state into the provided archive.

This function populates the given archive with all parameters required to fully represent the current state of the object. It ensures that the object can be reconstructed or transmitted accurately by saving all relevant data members in a consistent and structured format.

Parameters
archiveThe target archive that will store the serialized parameters.
Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 554 of file color_matrix_transformation_module.py.

◆ target_color_space() [1/2]

ColorSpace target_color_space ( self)

Returns the target color space used for chromatic adaptation.

Returns
The current target ColorSpace.
Since
ids_peak_icv 1.3

Definition at line 338 of file color_matrix_transformation_module.py.

◆ target_color_space() [2/2]

None target_color_space ( self,
ColorSpace color_space )

Sets the target color space for the chromatic adaptation transformation.

Parameters
color_spaceThe target ColorSpace.
Since
ids_peak_icv 1.3

Definition at line 356 of file color_matrix_transformation_module.py.

◆ type()

str type ( self)

Returns the type of the module for serialization purposes.

Returns
Module type
Since
ids_peak_icv 1.0

Definition at line 80 of file color_matrix_transformation_module.py.

◆ version()

int version ( self)

Return the module version.

Returns
Module version.
Since
ids_peak_icv 1.3

Reimplemented from ModuleBase.

Definition at line 92 of file color_matrix_transformation_module.py.

Field Documentation

◆ _auto_feature_module [1/2]

IAutoFeature | None _auto_feature_module = None
protected

Definition at line 71 of file color_matrix_transformation_module.py.

◆ _auto_feature_module [2/2]

np.ndarray _auto_feature_module = self.effective_matrix

Definition at line 662 of file color_matrix_transformation_module.py.

◆ _handle

_handle = _color_matrix_transformation_handle
protected

Definition at line 70 of file color_matrix_transformation_module.py.

◆ chromatic_adaption_algorithm

chromatic_adaption_algorithm = ChromaticAdaptionAlgorithm.BRADFORD

Definition at line 462 of file color_matrix_transformation_module.py.

◆ chromatic_adaption_enabled

chromatic_adaption_enabled = enabled

Definition at line 131 of file color_matrix_transformation_module.py.

◆ color_correction_enabled

color_correction_enabled = enabled

Definition at line 129 of file color_matrix_transformation_module.py.

◆ color_temperature

color_temperature

Definition at line 589 of file color_matrix_transformation_module.py.

◆ DEFAULT_MATRIX

np DEFAULT_MATRIX = np.eye(3)
static

Definition at line 34 of file color_matrix_transformation_module.py.

◆ DEFAULT_SATURATION

float DEFAULT_SATURATION = 1.0
static

Definition at line 42 of file color_matrix_transformation_module.py.

◆ enabled

enabled

Definition at line 523 of file color_matrix_transformation_module.py.

◆ matrix

matrix = self.DEFAULT_MATRIX

Definition at line 550 of file color_matrix_transformation_module.py.

◆ saturation

saturation = self.DEFAULT_SATURATION

Definition at line 551 of file color_matrix_transformation_module.py.

◆ saturation_enabled

saturation_enabled = enabled

Definition at line 130 of file color_matrix_transformation_module.py.

◆ SUPPORTED_PIXEL_FORMATS

list SUPPORTED_PIXEL_FORMATS
static
Initial value:
= [
PixelFormat.RGB_8, PixelFormat.RGB_10, PixelFormat.RGB_12, PixelFormat.BGR_8, PixelFormat.BGR_10,
PixelFormat.BGR_12, PixelFormat.RGBA_8, PixelFormat.RGBA_10, PixelFormat.RGBA_12, PixelFormat.BGRA_8,
PixelFormat.BGRA_10, PixelFormat.BGRA_12
]

Definition at line 50 of file color_matrix_transformation_module.py.

◆ target_color_space

target_color_space = ColorSpace.SRGB_D65

Definition at line 463 of file color_matrix_transformation_module.py.

◆ version

version

Definition at line 571 of file color_matrix_transformation_module.py.