IDS peak ICV v1.4.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)
 Gets whether this module is enabled.
 
None enabled (self, bool enabled)
 Enables or disables 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 settings to their defaults.
 
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

bool digital_black_enabled = enabled
 
bool gamma_enabled = enabled
 
 digital_black
 
 enabled
 
 version
 
 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

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.

◆ __del__()

None __del__ ( self)

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

◆ _apply_gamma()

None _apply_gamma ( self,
float value )
protected

Apply gamma correction to the backend.

Since
ids_peak_icv 1.0

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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

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

◆ gamma() [1/2]

float gamma ( self)

Gets the current gamma correction exponent.

Returns
The gamma exponent currently set.
Since
ids_peak_icv 1.0

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ reset_to_default()

None reset_to_default ( self)

Resets all settings to their defaults.

Default configuration:

  • gamma = 1.0
  • digital_black = 0.0
Note
The enabled state does not change when calling this function.
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.

◆ type()

str type ( self)

Returns the type of the module for serialization purposes.

Returns
Module type
Since
ids_peak_icv 1.0

Field Documentation

◆ _digital_black

_digital_black = 0.0
protected

◆ _digital_black_enabled

_digital_black_enabled = True
protected

◆ _gamma

_gamma = 1.0
protected

◆ _gamma_enabled

_gamma_enabled = True
protected

◆ _handle

_handle = handle
protected

◆ DEFAULT_DIGITAL_BLACK

float DEFAULT_DIGITAL_BLACK = 0.0
static

◆ DEFAULT_GAMMA

DEFAULT_GAMMA = 1.0
static

◆ digital_black

digital_black

◆ digital_black_enabled

bool digital_black_enabled = enabled

◆ enabled

enabled

◆ gamma

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

◆ gamma_enabled

bool gamma_enabled = enabled

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

◆ version

version