IDS peak ICV v1.1.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.
 
bool enabled (self)
 Get whether this module is enabled.
 
None enabled (self, bool enabled)
 Enable or disable the module.
 
np.ndarray matrix (self)
 Gets the current color correction matrix.
 
None matrix (self, np.ndarray matrix)
 Sets the current color correction matrix.
 
float saturation (self)
 Gets the current saturation value.
 
None saturation (self, float saturation)
 Sets the current saturation value.
 
Interval saturation_range (self)
 Gets the valid range for saturation.
 
bool color_correction_enabled (self)
 Whether color correction is enabled.
 
None color_correction_enabled (self, bool enabled)
 Whether color correction is enabled.
 
bool saturation_enabled (self)
 Whether saturation is enabled.
 
None saturation_enabled (self, bool enabled)
 Whether saturation is enabled.
 
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 module settings.
 
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.
 

Data Fields

 enabled
 
tuple _auto_feature_module
 

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 _apply_matrix (self)
 
None _apply_saturation (self)
 
np.ndarray _effective_matrix (self)
 
None _update_ccm_in_auto_feature_module (self)
 

Protected Attributes

bool _color_correction_enabled = True
 
bool _saturation_enabled = True
 
None|np.ndarray _matrix = None
 
float|None _saturation = None
 
IAutoFeature|None _auto_feature_module = None
 
 _handle = _color_matrix_transformation_handle
 
np.ndarray _matrix
 
float _saturation
 

Detailed Description

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

Provides the features ColorCorrectionFeature and SaturationFeature.

Default configuration:

  • Color correction matrix = 3x3 identity matrix
  • Saturation = 1.0
Since
ids_peak_icv 1.0

Definition at line 17 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 53 of file color_matrix_transformation_module.py.

◆ __del__()

None __del__ ( self)

Definition at line 77 of file color_matrix_transformation_module.py.

Member Function Documentation

◆ _apply_matrix()

None _apply_matrix ( self)
protected

Definition at line 344 of file color_matrix_transformation_module.py.

◆ _apply_saturation()

None _apply_saturation ( self)
protected

Definition at line 356 of file color_matrix_transformation_module.py.

◆ _effective_matrix()

np.ndarray _effective_matrix ( self)
protected

Definition at line 364 of file color_matrix_transformation_module.py.

◆ _set_autofeature_module()

None _set_autofeature_module ( self,
IAutoFeature | None auto_feature_module )
protected

Definition at line 340 of file color_matrix_transformation_module.py.

◆ _update_ccm_in_auto_feature_module()

None _update_ccm_in_auto_feature_module ( self)
protected

Definition at line 372 of file color_matrix_transformation_module.py.

◆ color_correction_enabled() [1/2]

bool color_correction_enabled ( self)

Whether color correction is enabled.

Returns
True if color correction is applied during processing.
Since
ids_peak_icv 1.0

Definition at line 192 of file color_matrix_transformation_module.py.

◆ color_correction_enabled() [2/2]

None color_correction_enabled ( self,
bool enabled )

Whether color correction is enabled.

Parameters
enabledTrue if color correction is enabled.
Since
ids_peak_icv 1.0

Definition at line 204 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 311 of file color_matrix_transformation_module.py.

◆ enabled() [1/2]

bool enabled ( self)

Get 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 94 of file color_matrix_transformation_module.py.

◆ enabled() [2/2]

None enabled ( self,
bool enabled )

Enable or disable 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 108 of file color_matrix_transformation_module.py.

◆ matrix() [1/2]

np.ndarray matrix ( self)

Gets the current color correction matrix.

Returns
The color correction matrix currently set.
Since
ids_peak_icv 1.0

Definition at line 124 of file color_matrix_transformation_module.py.

◆ matrix() [2/2]

None matrix ( self,
np.ndarray matrix )

Sets the current color correction matrix.

Parameters
matrixThe color correction matrix.
Since
ids_peak_icv 1.0

Definition at line 136 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.

This operation disregards any specified image regions and processes the entire image.

Parameters
input_imageThe input image to be processed.
Returns
A new image with color correction and/or saturation applied.
Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 242 of file color_matrix_transformation_module.py.

◆ reset_to_default()

None reset_to_default ( self)

Resets all module settings.

Restores the module configuration to its default values:

  • matrix = identity
  • saturation = 1.0
Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 272 of file color_matrix_transformation_module.py.

◆ saturation() [1/2]

float saturation ( self)

Gets the current saturation value.

Returns
The saturation value currently set.
Since
ids_peak_icv 1.0

Definition at line 150 of file color_matrix_transformation_module.py.

◆ saturation() [2/2]

None saturation ( self,
float saturation )

Sets the current saturation value.

Parameters
saturationThe saturation value.
Since
ids_peak_icv 1.0

Definition at line 162 of file color_matrix_transformation_module.py.

◆ saturation_enabled() [1/2]

bool saturation_enabled ( self)

Whether saturation is enabled.

Returns
True if saturation is applied during processing.
Since
ids_peak_icv 1.0

Definition at line 218 of file color_matrix_transformation_module.py.

◆ saturation_enabled() [2/2]

None saturation_enabled ( self,
bool enabled )

Whether saturation is enabled.

Parameters
enabledTrue if saturation is enabled.
Since
ids_peak_icv 1.0

Definition at line 230 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 176 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.

Returns
The serialized module's internal state.
Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 286 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

Reimplemented from IModule.

Definition at line 82 of file color_matrix_transformation_module.py.

Field Documentation

◆ _auto_feature_module [1/2]

IAutoFeature | None _auto_feature_module = None
protected

Definition at line 66 of file color_matrix_transformation_module.py.

◆ _auto_feature_module [2/2]

tuple _auto_feature_module
Initial value:
= (self._effective_matrix() if (self._saturation_enabled
or self._color_correction_enabled) else np.identity(3, dtype=float))

Definition at line 373 of file color_matrix_transformation_module.py.

◆ _color_correction_enabled

_color_correction_enabled = True
protected

Definition at line 62 of file color_matrix_transformation_module.py.

◆ _handle

_handle = _color_matrix_transformation_handle
protected

Definition at line 75 of file color_matrix_transformation_module.py.

◆ _matrix [1/2]

_matrix = None
protected

Definition at line 64 of file color_matrix_transformation_module.py.

◆ _matrix [2/2]

np.ndarray _matrix
protected

Definition at line 133 of file color_matrix_transformation_module.py.

◆ _saturation [1/2]

_saturation = None
protected

Definition at line 65 of file color_matrix_transformation_module.py.

◆ _saturation [2/2]

float _saturation
protected

Definition at line 159 of file color_matrix_transformation_module.py.

◆ _saturation_enabled

_saturation_enabled = True
protected

Definition at line 63 of file color_matrix_transformation_module.py.

◆ DEFAULT_MATRIX

np DEFAULT_MATRIX = np.eye(3)
static

Definition at line 31 of file color_matrix_transformation_module.py.

◆ DEFAULT_SATURATION

float DEFAULT_SATURATION = 1.0
static

Definition at line 39 of file color_matrix_transformation_module.py.

◆ enabled

enabled

Definition at line 259 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 47 of file color_matrix_transformation_module.py.