1from __future__
import annotations
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 Indicates whether the feature is currently enabled.
61 @return True if enabled; otherwise, False.
63 @since ids_peak_icv 1.0
71 Enables or disables the feature.
72 @param value: Set to True to enable the feature, or False to disable it.
74 @since ids_peak_icv 1.0
81 Resets the all gain values to 1.0.
83 @note The enabled state does not change when calling this function.
85 @since ids_peak_icv 1.0
90 def red(self) -> float:
93 Retrieves the current red gain.
94 @return The current red gain.
96 @since ids_peak_icv 1.0
101 def red(self, value: float) ->
None:
104 Sets the red gain value.
106 Sets the color gain for the red channel. The valid range for the gain value can be
107 obtained using the range property.
109 @param value: The red gain value to set.
111 @exception OutOfRangeException: If the gain value is outside the valid range.
113 @since ids_peak_icv 1.0
121 Retrieves the current green gain.
122 @return The current green gain.
124 @since ids_peak_icv 1.0
129 def green(self, value: float) ->
None:
132 Sets the green gain value.
134 Sets the color gain for the green channel. The valid range for the gain value can be
135 obtained using the range property.
137 @param value: The green gain value to set.
139 @exception OutOfRangeException: If the gain value is outside the valid range.
141 @since ids_peak_icv 1.0
149 Retrieves the current blue gain.
150 @return The current blue gain.
152 @since ids_peak_icv 1.0
157 def blue(self, value: float) ->
None:
160 Sets the blue gain value.
162 Sets the color gain for the blue channel. The valid range for the gain value can be
163 obtained using the range property.
165 @param value: The blue gain value to set.
167 @exception OutOfRangeException: If the gain value is outside the valid range.
169 @since ids_peak_icv 1.0
177 Retrieves the current master gain.
178 @return The current master gain.
180 @since ids_peak_icv 1.0
188 Sets the master gain value.
190 Sets the color gain for the master channel. The valid range for the gain value can be
191 obtained using the range property.
193 @param value: The master gain value to set.
195 @exception OutOfRangeException: If the gain value is outside the valid range.
197 @since ids_peak_icv 1.0
205 Retrieves the valid range for the gamma correction exponent.
207 The returned interval specifies the minimum and maximum values that can be passed to value property.
209 @return An Interval representing the valid gamma range.
211 @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 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)
Indicates whether the 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.