IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
digital_black_feature.py
Go to the documentation of this file.
1from __future__ import annotations
2
3from ids_peak_common.datatypes.interval import Interval
4from ids_peak_icv.pipeline._internal.tone_curve_correction_module import ToneCurveCorrectionModule
6
7
9 """!
10 @brief
11 Digital black applies digital black correction to an image.
12
13 @supportedPixelformats{ToneCurveCorrection}
14
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.
20
21 The correction is performed using the following formula::
22
23 color_value_out = clamp((color_value_in - black) / (1.0 - black), 0.0, 1.0);
24
25 where:
26
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
30
31 All input and output values are in the normalized range [0.0, 1.0].
32
33 The default value for digital black is 0.0.
34
35 @since ids_peak_icv 1.0
36 @ingroup ids_peak_icv_python_pipeline_features
37 """
38
39 def __init__(self, module: ToneCurveCorrectionModule) -> None:
40 """!
41 @brief
42 Creates a digital black feature for an existing tone curve correction module.
43 @param module: Reference to the underlying module
44
45 @since ids_peak_icv 1.0
46 """
47 self._module = module
48
49 @property
50 def enabled(self) -> bool:
51 """!
52 @brief
53 Gets whether this feature is currently enabled.
54
55 @return True if enabled; otherwise False.
56
57 @since ids_peak_icv 1.0
58 """
59 return self._module.digital_black_enabled
60
61 @enabled.setter
62 def enabled(self, enabled: bool) -> None:
63 """!
64 @brief
65 Enables or disables the feature.
66
67 @param enabled: True to enable, False to disable.
68
69 @since ids_peak_icv 1.0
70 """
71 self._module.digital_black_enabled = enabled
72
73 def reset_to_default(self) -> None:
74 """!
75 @brief
76 Resets the black level to its default value (0.0).
77
78 @note The enabled state does not change when calling this function.
79
80 @since ids_peak_icv 1.0
81 """
82 self.valuevaluevalue = 0.0
83
84 @property
85 def value(self) -> float:
86 """!
87 @brief
88 Gets the current black level value.
89 @return The black level value currently set.
90
91 @since ids_peak_icv 1.0
92 """
93 return self._module.digital_black
94
95 @value.setter
96 def value(self, digital_black: float) -> None:
97 """!
98 @brief
99 Sets the black level value.
100
101 This value is subtracted from the input image channel values before normalizing it.
102 It typically represents sensor black offset.
103
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.
106
107 @exception OutOfRangeException: If digital black value is outside the valid range.
108
109 @since ids_peak_icv 1.0
110 """
111 self._module.digital_black = digital_black
112
113 @property
114 def range(self) -> Interval:
115 """!
116 @brief
117 Retrieves the valid range for the black level value.
118
119 The returned interval specifies the minimum and maximum values that can be passed to value property.
120
121 @return An Interval representing the valid black level range.
122
123 @since ids_peak_icv 1.0
124 """
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).
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.
Definition ifeature.py:6