IDS peak ICV v1.2.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 Indicates whether the feature is currently enabled.
54 @return True if enabled; otherwise, False.
55
56 @since ids_peak_icv 1.0
57 """
58 return self._module.digital_black_enabled
59
60 @enabled.setter
61 def enabled(self, value: bool) -> None:
62 """!
63 @brief
64 Enables or disables the feature.
65 @param value: Set to True to enable the feature, or False to disable it.
66
67 @since ids_peak_icv 1.0
68 """
69 self._module.digital_black_enabled = value
70
71 def reset_to_default(self) -> None:
72 """!
73 @brief
74 Resets the black level value to 0.0.
75
76 @note The enabled state does not change when calling this function.
77
78 @since ids_peak_icv 1.0
79 """
80 self.valuevaluevalue = 0.0
81
82 @property
83 def value(self) -> float:
84 """!
85 @brief
86 Gets the current black level value.
87 @return The black level value currently set.
88
89 @since ids_peak_icv 1.0
90 """
91 return self._module.digital_black
92
93 @value.setter
94 def value(self, digital_black: float) -> None:
95 """!
96 @brief
97 Sets the black level value.
98
99 This value is subtracted from the input image channel values before normalizing it.
100 It typically represents sensor black offset.
101
102 @param digital_black: A floating-point value representing the digital black value in normalized units.
103 Valid values are within the range returned by range property.
104
105 @exception OutOfRangeException: If digital black value is outside the valid range.
106
107 @since ids_peak_icv 1.0
108 """
109 self._module.digital_black = digital_black
110
111 @property
112 def range(self) -> Interval:
113 """!
114 @brief
115 Retrieves the valid range for the black level value.
116
117 The returned interval specifies the minimum and maximum values that can be passed to value property.
118
119 @return An Interval representing the valid black level range.
120
121 @since ids_peak_icv 1.0
122 """
123 return self._module.digital_black_range
Digital black applies digital black correction to an image.
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)
Indicates whether the 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