IDS peak ICV v1.6.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

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.

◆ __del__()

None __del__ ( self)

Member Function Documentation

◆ _set_autofeature_module()

None _set_autofeature_module ( self,
IAutoFeature | None auto_feature_module )
protected

◆ _update_matrix_in_auto_feature_module()

None _update_matrix_in_auto_feature_module ( self)
protected

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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.

◆ 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

◆ 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.

◆ 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.

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ reset_color_temperature()

None reset_color_temperature ( self)

Resets the color temperature to its default, uninitialized state.

Since
ids_peak_icv 1.3

◆ 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

◆ saturation() [1/2]

float saturation ( self)

Gets the current saturation value.

Returns
The current saturation value.
Since
ids_peak_icv 1.0

◆ saturation() [2/2]

None saturation ( self,
float saturation )

Sets the saturation value.

Parameters
saturationThe saturation value.
Since
ids_peak_icv 1.0

◆ 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

◆ 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

◆ saturation_range()

Interval saturation_range ( self)

Gets the valid range for saturation.

Returns
The valid saturation range.
Since
ids_peak_icv 1.0

◆ 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.

◆ 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

◆ 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

◆ type()

str type ( self)

Returns the type of the module for serialization purposes.

Returns
Module type
Since
ids_peak_icv 1.0

◆ version()

int version ( self)

Return the module version.

Returns
Module version.
Since
ids_peak_icv 1.3

Reimplemented from ModuleBase.

Field Documentation

◆ _auto_feature_module [1/2]

IAutoFeature | None _auto_feature_module = None
protected

◆ _auto_feature_module [2/2]

np.ndarray _auto_feature_module = self.effective_matrix

◆ _handle

_handle = _color_matrix_transformation_handle
protected

◆ chromatic_adaption_algorithm

chromatic_adaption_algorithm = ChromaticAdaptionAlgorithm.BRADFORD

◆ chromatic_adaption_enabled

chromatic_adaption_enabled = enabled

◆ color_correction_enabled

color_correction_enabled = enabled

◆ color_temperature

color_temperature

◆ DEFAULT_MATRIX

np DEFAULT_MATRIX = np.eye(3)
static

◆ DEFAULT_SATURATION

float DEFAULT_SATURATION = 1.0
static

◆ enabled

enabled

◆ matrix

matrix = self.DEFAULT_MATRIX

◆ saturation

saturation = self.DEFAULT_SATURATION

◆ saturation_enabled

saturation_enabled = enabled

◆ 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
]

◆ target_color_space

target_color_space = ColorSpace.SRGB_D65

◆ version

version