1from __future__
import annotations
3from ids_peak_common.datatypes.interval
import Interval
11 Digital black applies digital black correction to an image.
13 @supportedPixelformats{ToneCurveCorrection}
15 This feature adjusts the image luminance by first subtracting a digital black and then normalizing the result.
16 This compensates for sensor digital black offsets.
17 The correction is applied independently to each channel in the image.
18 For RGB images, it is applied to each color channel (R, G, B), and for monochrome images,
19 it is applied to the single intensity channel.
21 The correction is performed using the following formula::
23 color_value_out = clamp((color_value_in - black) / (1.0 - black), 0.0, 1.0);
27 - color_value_in is the input channel value
28 - black is the digital black to be subtracted (in normalized units)
29 - color_value_out is the resulting output value
31 All input and output values are in the normalized range [0.0, 1.0].
33 The default value for digital black is 0.0.
35 @since ids_peak_icv 1.0
36 @ingroup ids_peak_icv_python_pipeline_features
39 def __init__(self, module: ToneCurveCorrectionModule) ->
None:
42 Creates a digital black feature for an existing tone curve correction module.
43 @param module: Reference to the underlying module
45 @since ids_peak_icv 1.0
53 Gets whether this feature is currently enabled.
55 @return True if enabled; otherwise False.
57 @since ids_peak_icv 1.0
59 return self.
_module.digital_black_enabled
65 Enables or disables the feature.
67 @param enabled: True to enable, False to disable.
69 @since ids_peak_icv 1.0
71 self.
_module.digital_black_enabled = enabled
76 Resets the black level to its default value (0.0).
78 @note The enabled state does not change when calling this function.
80 @since ids_peak_icv 1.0
88 Gets the current black level value.
89 @return The black level value currently set.
91 @since ids_peak_icv 1.0
93 return self.
_module.digital_black
96 def value(self, digital_black: float) ->
None:
99 Sets the black level value.
101 This value is subtracted from the input image channel values before normalizing it.
102 It typically represents sensor black offset.
104 @param digital_black: A floating-point value representing the digital black value in normalized units.
105 Valid values are within the range returned by range property.
107 @exception OutOfRangeException: If digital black value is outside the valid range.
109 @since ids_peak_icv 1.0
111 self.
_module.digital_black = digital_black
117 Retrieves the valid range for the black level value.
119 The returned interval specifies the minimum and maximum values that can be passed to value property.
121 @return An Interval representing the valid black level range.
123 @since ids_peak_icv 1.0
125 return self.
_module.digital_black_range
Digital black applies digital black correction to an image.
None reset_to_default(self)
Resets the black level to its default value (0.0).
float value(self)
Gets the current black level value.
None value(self, float digital_black)
Sets the black level value.
None __init__(self, ToneCurveCorrectionModule module)
Creates a digital black feature for an existing tone curve correction module.
bool enabled(self)
Gets whether this feature is currently enabled.
Interval range(self)
Retrieves the valid range for the black level value.
Abstract base class for all image processing pipeline features.