IDS peak ICV v1.2.0
Loading...
Searching...
No Matches
ToneCurveCorrectionModule Class Reference
Inheritance diagram for ToneCurveCorrectionModule:

Public Member Functions

None __init__ (self)
 Initialize a tone curve correction 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 value)
 Enable or disable the module.
 
float gamma (self)
 Gets the current gamma correction exponent.
 
None gamma (self, float value)
 Sets the gamma correction exponent.
 
Interval gamma_range (self)
 Returns the valid range for the gamma correction exponent.
 
bool gamma_enabled (self)
 Whether gamma correction is enabled.
 
None gamma_enabled (self, bool enabled)
 Whether gamma correction is enabled.
 
float digital_black (self)
 Gets the current digital black offset.
 
None digital_black (self, float value)
 Sets the digital black used for digital black correction.
 
Interval digital_black_range (self)
 Returns the valid range for the digital black correction value.
 
bool digital_black_enabled (self)
 Whether digital black correction is enabled.
 
None digital_black_enabled (self, bool enabled)
 Whether digital black correction is enabled.
 
None reset_to_default (self)
 Resets all module settings.
 
Image process (self, Image input_image)
 Processes the input image and returns a tone curve corrected output image.
 
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

 digital_black
 
 enabled
 
 digital_black_enabled
 
 version
 
 gamma_enabled = gamma_archive.get("Enabled", bool)
 
 gamma = float(gamma_archive.get("Value", float))
 

Static Public Attributes

float DEFAULT_GAMMA = 1.0
 
float DEFAULT_DIGITAL_BLACK = 0.0
 
list SUPPORTED_PIXEL_FORMATS
 

Protected Member Functions

None _apply_gamma (self, float value)
 Apply gamma correction to the backend.
 
None _apply_digital_black (self, float value)
 Apply digital black correction to the backend.
 

Protected Attributes

 _handle = handle
 
float _gamma = 1.0
 
float _digital_black = 0.0
 
bool _gamma_enabled = True
 
bool _digital_black_enabled = True
 

Detailed Description

A pipeline module for applying tone curve corrections such as gamma adjustment and digital black offset.

Both, gamma and digital black corrections can be individually enabled or disabled.

Default configuration:

  • gamma = 1.0
  • digital black = 0.0
Since
ids_peak_icv 1.0

Definition at line 12 of file tone_curve_correction_module.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self)

Initialize a tone curve correction module with default settings.

Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 38 of file tone_curve_correction_module.py.

◆ __del__()

None __del__ ( self)

Definition at line 59 of file tone_curve_correction_module.py.

Member Function Documentation

◆ _apply_digital_black()

None _apply_digital_black ( self,
float value )
protected

Apply digital black correction to the backend.

Since
ids_peak_icv 1.0

Definition at line 362 of file tone_curve_correction_module.py.

◆ _apply_gamma()

None _apply_gamma ( self,
float value )
protected

Apply gamma correction to the backend.

Since
ids_peak_icv 1.0

Definition at line 349 of file tone_curve_correction_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 322 of file tone_curve_correction_module.py.

◆ digital_black() [1/2]

float digital_black ( self)

Gets the current digital black offset.

Returns
The digital black value currently set.
Since
ids_peak_icv 1.0

Definition at line 177 of file tone_curve_correction_module.py.

◆ digital_black() [2/2]

None digital_black ( self,
float value )

Sets the digital black used for digital black correction.

This value is subtracted from the input image channel values before gamma correction. It typically represents sensor black offset.

Note
The digital black must be within the valid range returned by digital_black_range property.
Parameters
valueThe digital black value in normalized units.
Since
ids_peak_icv 1.0

Definition at line 189 of file tone_curve_correction_module.py.

◆ digital_black_enabled() [1/2]

bool digital_black_enabled ( self)

Whether digital black correction is enabled.

Returns
True if the digital black offset is applied.
Since
ids_peak_icv 1.0

Definition at line 222 of file tone_curve_correction_module.py.

◆ digital_black_enabled() [2/2]

None digital_black_enabled ( self,
bool enabled )

Whether digital black correction is enabled.

Parameters
enabledTrue if the digital black offset is applied.
Since
ids_peak_icv 1.0

Definition at line 234 of file tone_curve_correction_module.py.

◆ digital_black_range()

Interval digital_black_range ( self)

Returns the valid range for the digital black correction value.

Returns
An Interval containing the minimum and maximum allowed digital black values.
Since
ids_peak_icv 1.0

Definition at line 207 of file tone_curve_correction_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 75 of file tone_curve_correction_module.py.

◆ enabled() [2/2]

None enabled ( self,
bool value )

Enable or disable the module.

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

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

Reimplemented from ModuleBase.

Definition at line 89 of file tone_curve_correction_module.py.

◆ gamma() [1/2]

float gamma ( self)

Gets the current gamma correction exponent.

Returns
The gamma exponent currently set.
Since
ids_peak_icv 1.0

Definition at line 104 of file tone_curve_correction_module.py.

◆ gamma() [2/2]

None gamma ( self,
float value )

Sets the gamma correction exponent.

This value determines the degree of inverse gamma correction applied during processing, where output values are computed as pow(input, 1/gamma). Higher gamma values lighten the image, while values closer to zero darken it.

Note
The gamma exponent must be within the valid range returned by gamma_range property.
Parameters
valueThe gamma exponent.
Since
ids_peak_icv 1.0

Definition at line 116 of file tone_curve_correction_module.py.

◆ gamma_enabled() [1/2]

bool gamma_enabled ( self)

Whether gamma correction is enabled.

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

Definition at line 151 of file tone_curve_correction_module.py.

◆ gamma_enabled() [2/2]

None gamma_enabled ( self,
bool enabled )

Whether gamma correction is enabled.

Parameters
enabledTrue if gamma correction is enabled.
Since
ids_peak_icv 1.0

Definition at line 163 of file tone_curve_correction_module.py.

◆ gamma_range()

Interval gamma_range ( self)

Returns the valid range for the gamma correction exponent.

Returns
An Interval containing the minimum and maximum allowed gamma values.
Since
ids_peak_icv 1.0

Definition at line 136 of file tone_curve_correction_module.py.

◆ process()

Image process ( self,
Image input_image )

Processes the input image and returns a tone curve corrected output image.

Supported pixel formats
  • Mono8
  • Mono10
  • Mono12
  • Mono16
  • BayerBG8
  • BayerBG10
  • BayerBG12
  • BayerGB8
  • BayerGB10
  • BayerGB12
  • BayerRG8
  • BayerRG10
  • BayerRG12
  • BayerGR8
  • BayerGR10
  • BayerGR12
  • RGB8
  • RGBa8
  • BGR8
  • BGRa8
  • RGB10
  • RGBa10
  • BGR10
  • BGRa10
  • RGB12
  • RGBa12
  • BGR12
  • BGRa12

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 tone curve correction applied.
Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 263 of file tone_curve_correction_module.py.

◆ reset_to_default()

None reset_to_default ( self)

Resets all module settings.

Restores the module configuration to its default values:

  • gamma = 1.0
  • digital_black = 0.0
Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 247 of file tone_curve_correction_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 296 of file tone_curve_correction_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 64 of file tone_curve_correction_module.py.

Field Documentation

◆ _digital_black

float _digital_black = 0.0
protected

Definition at line 55 of file tone_curve_correction_module.py.

◆ _digital_black_enabled

_digital_black_enabled = True
protected

Definition at line 57 of file tone_curve_correction_module.py.

◆ _gamma

float _gamma = 1.0
protected

Definition at line 54 of file tone_curve_correction_module.py.

◆ _gamma_enabled

_gamma_enabled = True
protected

Definition at line 56 of file tone_curve_correction_module.py.

◆ _handle

_handle = handle
protected

Definition at line 53 of file tone_curve_correction_module.py.

◆ DEFAULT_DIGITAL_BLACK

float DEFAULT_DIGITAL_BLACK = 0.0
static

Definition at line 29 of file tone_curve_correction_module.py.

◆ DEFAULT_GAMMA

float DEFAULT_GAMMA = 1.0
static

Definition at line 28 of file tone_curve_correction_module.py.

◆ digital_black

digital_black

Definition at line 261 of file tone_curve_correction_module.py.

◆ digital_black_enabled

digital_black_enabled

Definition at line 286 of file tone_curve_correction_module.py.

◆ enabled

enabled

Definition at line 280 of file tone_curve_correction_module.py.

◆ gamma

gamma = float(gamma_archive.get("Value", float))

Definition at line 343 of file tone_curve_correction_module.py.

◆ gamma_enabled

gamma_enabled = gamma_archive.get("Enabled", bool)

Definition at line 342 of file tone_curve_correction_module.py.

◆ SUPPORTED_PIXEL_FORMATS

list SUPPORTED_PIXEL_FORMATS
static
Initial value:
= [
PixelFormat.MONO_8, PixelFormat.MONO_10, PixelFormat.MONO_12, PixelFormat.MONO_16, 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 31 of file tone_curve_correction_module.py.

◆ version

version

Definition at line 310 of file tone_curve_correction_module.py.