1from __future__
import annotations
3from ids_peak_common.datatypes.interval
import Interval
11 Gain is an image pipeline feature that applies gain correction to an image.
13 @supportedPixelformats{Gain}
15 Gain is used to adjust pixel intensities either uniformly across all color channels using the master gain,
16 or individually per channel using the red, green, and blue gains.
17 With master gain, image brightness can be increased.
18 With color gains, the white balance can be adjusted.
19 For color images, gain is applied as follows::
21 red_value_out = red_value_in * red_gain * master_gain
22 green_value_out = green_value_in * green_gain * master_gain
23 blue_value_out = blue_value_in * blue_gain * master_gain
25 where red_value_in, green_value_in, and blue_value_in are the input red, green, and blue channel values, respectively,
26 and red_value_out, green_value_out, and blue_value_out are the corresponding output values.
27 All RGB values are normalized to the range [0.0, 1.0].
28 For mono images, the color gains are ignored and applied as follows::
30 gray_value_out = gray_value_in * master_gain
32 where gray_value_in is the input and gray_value_out the output value, normalized to the range [0.0, 1.0].
34 Warning: Excessive gain values may cause clipping and loss of image detail in bright areas.
36 Default configuration:
42 @since ids_peak_icv 1.0
43 @ingroup ids_peak_icv_python_pipeline_features
46 def __init__(self, module: GainModule) ->
None:
49 Creates a gain feature for an existing gain module.
50 @param module: Reference to the underlying module
52 @since ids_peak_icv 1.0
60 Gets whether this feature is currently enabled.
62 @return True if enabled; otherwise False.
64 @since ids_peak_icv 1.0
72 Enables or disables the feature.
74 @param enabled: True to enable, False to disable.
76 @since ids_peak_icv 1.0
83 Resets the all gain values to their default value (1.0).
85 @note The enabled state does not change when calling this function.
87 @since ids_peak_icv 1.0
92 def red(self) -> float:
95 Retrieves the current red gain.
96 @return The current red gain.
98 @since ids_peak_icv 1.0
103 def red(self, value: float) ->
None:
106 Sets the red gain value.
108 Sets the color gain for the red channel. The valid range for the gain value can be
109 obtained using the range property.
111 @param value: The red gain value to set.
113 @exception OutOfRangeException: If the gain value is outside the valid range.
115 @since ids_peak_icv 1.0
123 Retrieves the current green gain.
124 @return The current green gain.
126 @since ids_peak_icv 1.0
131 def green(self, value: float) ->
None:
134 Sets the green gain value.
136 Sets the color gain for the green channel. The valid range for the gain value can be
137 obtained using the range property.
139 @param value: The green gain value to set.
141 @exception OutOfRangeException: If the gain value is outside the valid range.
143 @since ids_peak_icv 1.0
151 Retrieves the current blue gain.
152 @return The current blue gain.
154 @since ids_peak_icv 1.0
159 def blue(self, value: float) ->
None:
162 Sets the blue gain value.
164 Sets the color gain for the blue channel. The valid range for the gain value can be
165 obtained using the range property.
167 @param value: The blue gain value to set.
169 @exception OutOfRangeException: If the gain value is outside the valid range.
171 @since ids_peak_icv 1.0
179 Retrieves the current master gain.
180 @return The current master gain.
182 @since ids_peak_icv 1.0
190 Sets the master gain value.
192 Sets the color gain for the master channel. The valid range for the gain value can be
193 obtained using the range property.
195 @param value: The master gain value to set.
197 @exception OutOfRangeException: If the gain value is outside the valid range.
199 @since ids_peak_icv 1.0
207 Retrieves the valid range for the gamma correction exponent.
209 The returned interval specifies the minimum and maximum values that can be passed to value property.
211 @return An Interval representing the valid gamma range.
213 @since ids_peak_icv 1.0
Gain is an image pipeline feature that applies gain correction to an image.
None reset_to_default(self)
Resets the all gain values to their default value (1.0).
float red(self)
Retrieves the current red gain.
None __init__(self, GainModule module)
Creates a gain feature for an existing gain module.
float green(self)
Retrieves the current green gain.
float blue(self)
Retrieves the current blue gain.
bool enabled(self)
Gets whether this feature is currently enabled.
Interval range(self)
Retrieves the valid range for the gamma correction exponent.
float master(self)
Retrieves the current master gain.
Abstract base class for all image processing pipeline features.