1from __future__
import annotations
3from ids_peak_common.datatypes.interval
import Interval
11 Gamma applies an inverse gamma transformation to an image.
13 @supportedPixelformats{ToneCurveCorrection}
15 This module adjusts the image luminance by applying an inverse gamma correction.
16 This prepares the image for a linear domain or further processing.
18 The correction is applied independently to each channel in the image.
19 For RGB images, it is applied to each color channel (R, G, B),
20 and for monochrome images, it is applied to the single intensity channel.
22 The correction is performed using the following formula: `color_value ^ (1.0 / gamma)`
24 @warning Gamma values close to zero may result in very dark images,
25 while very high values may cause loss of detail in dark areas.
26 Use values within the range returned by range property.
28 The default value for gamma is 1.0.
30 @since ids_peak_icv 1.0
31 @ingroup ids_peak_icv_python_pipeline_features
34 def __init__(self, module: ToneCurveCorrectionModule) ->
None:
37 Creates a gamma feature for an existing tone curve correction module.
38 @param module: Reference to the underlying module
46 Gets whether this feature is currently enabled.
48 @return True if enabled; otherwise False.
50 @since ids_peak_icv 1.0
52 return self.
_module.gamma_enabled
58 Enables or disables the feature.
60 @param enabled: True to enable, False to disable.
62 @since ids_peak_icv 1.0
64 self.
_module.gamma_enabled = enabled
69 Resets the gamma value to its default value (1.0).
71 @note The enabled state does not change when calling this function.
73 @since ids_peak_icv 1.0
81 Gets the current gamma correction exponent.
82 @return The gamma exponent currently set.
84 @since ids_peak_icv 1.0
89 def value(self, gamma: float) ->
None:
92 Sets the gamma correction exponent.
94 This value determines the degree of inverse gamma correction applied during processing,
95 where output values are computed as input ^ (1/gamma).
96 Higher gamma values lighten the image, while values closer to zero darken it.
98 @param gamma: A floating-point value representing the gamma exponent.
99 Valid values are within the range returned by range property.
101 @exception OutOfRangeException: If gamma is outside the valid range.
103 @since ids_peak_icv 1.0
111 Retrieves the valid range for the gamma correction exponent.
113 The returned interval specifies the minimum and maximum values that can be passed to value property.
115 @return An Interval representing the valid gamma range.
117 @since ids_peak_icv 1.0
119 return self.
_module.gamma_range
Gamma applies an inverse gamma transformation to an image.
None reset_to_default(self)
Resets the gamma value to its default value (1.0).
float value(self)
Gets the current gamma correction exponent.
None value(self, float gamma)
Sets the gamma correction exponent.
None __init__(self, ToneCurveCorrectionModule module)
Creates a gamma 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 gamma correction exponent.
Abstract base class for all image processing pipeline features.