1from __future__
import annotations
4from ids_peak_common.datatypes.range
import Range
6 ColorMatrixTransformationModule
8from ids_peak_icv.pipeline.datatypes
import ColorSpace, ChromaticAdaptionAlgorithm
15 Adjusts to changes in lighting conditions to maintain consistent color perception
16 despite variations in light sources.
18 In industrial imaging, white balance can fail due to the lack of a neutral reference in the image, such as when the
19 scene contains no gray or white areas, or when the colors are unevenly distributed (as in images dominated by a single color).
20 In these cases, traditional white balance algorithms, like the gray world method, may fail to produce accurate color corrections.
22 Chromatic adaptation provides an alternative solution by adjusting the image’s colors based on the known or
23 estimated correlated color temperature of the light source.
26 If chromatic adaption is used in combination with white balance, the result is indefinite.
28 Default Configuration:
29 - Chromatic adaption algorithm = Bradford
30 - Color space = SRGB_D65
31 - Color temperature = undefined (chromatic adaption won't be applied)
33 @since ids_peak_icv 1.3
34 @ingroup ids_peak_icv_python_pipeline_features
37 def __init__(self, module: ColorMatrixTransformationModule) ->
None:
40 Creates a ChromaticAdaptionFeature for an existing color matrix transformation module.
42 @param module: Reference to the underlying ColorMatrixTransformationModule.
44 @since ids_peak_icv 1.3
52 Indicates whether chromatic adaptation is enabled.
54 @return True if enabled; otherwise, False.
56 @since ids_peak_icv 1.3
58 return self.
_module.chromatic_adaption_enabled
64 Enables or disables chromatic adaptation.
66 @param value: Set to True to enable the feature, or False to disable it.
68 @since ids_peak_icv 1.3
70 self.
_module.chromatic_adaption_enabled = value
75 Resets the chromatic adaption configuration to the default values.
77 @note The enabled state does not change when calling this function.
79 @since ids_peak_icv 1.3
81 self.
_module.reset_chromatic_adaption()
87 Retrieves the current target color space.
89 @return The currently set color space.
91 @since ids_peak_icv 1.3
93 return self.
_module.target_color_space
95 @target_color_space.setter
99 Sets the target color space.
101 A color space is a specific implementation of a color model, mapping colors to a defined range of values
102 (e.g., standard primaries, white point, and gamma).
104 @param value: The color space to set.
106 @since ids_peak_icv 1.3
108 self.
_module.target_color_space = value
114 Retrieves the current chromatic adaption algorithm.
116 @return The currently set chromatic adaption algorithm.
118 @since ids_peak_icv 1.3
120 return self.
_module.chromatic_adaption_algorithm
123 def algorithm(self, value: ChromaticAdaptionAlgorithm) ->
None:
126 Sets the algorithm used for chromatic adaption.
128 The algorithms use a CAT (chromatic adaptation transform) matrix.
130 @param value: The chromatic adaption algorithm to set.
132 @since ids_peak_icv 1.3
134 self.
_module.chromatic_adaption_algorithm = value
140 Retrieves the current color temperature.
142 @return The current color temperature in Kelvin.
144 @exception NotPossibleException: If the color temperature has not been set (it has no default value).
146 @since ids_peak_icv 1.3
148 return self.
_module.color_temperature
150 @color_temperature.setter
154 Sets the color temperature of the light source.
155 If no color temperature is explicitly set the chromatic adaption won't be applied.
157 @param value: The color temperature in Kelvin to set. Must be within the allowed range.
159 @since ids_peak_icv 1.3
161 self.
_module.color_temperature = value
166 Checks whether a color temperature has been set.
168 @return True if a color temperature is set, False otherwise.
170 @since ids_peak_icv 1.3
178 Returns the allowed temperature range for the current combination of color space and algorithm.
180 @return A Range representing the allowed temperature range in Kelvin.
182 @since ids_peak_icv 1.3
184 return self.
_module.color_temperature_range
Adjusts to changes in lighting conditions to maintain consistent color perception despite variations ...
None reset_to_default(self)
Resets the chromatic adaption configuration to the default values.
int color_temperature(self)
Retrieves the current color temperature.
None __init__(self, ColorMatrixTransformationModule module)
Creates a ChromaticAdaptionFeature for an existing color matrix transformation module.
ChromaticAdaptionAlgorithm algorithm(self)
Retrieves the current chromatic adaption algorithm.
bool has_color_temperature(self)
Checks whether a color temperature has been set.
bool enabled(self)
Indicates whether chromatic adaptation is enabled.
ColorSpace target_color_space(self)
Retrieves the current target color space.
Range color_temperature_range(self)
Returns the allowed temperature range for the current combination of color space and algorithm.
Abstract base class for all image processing pipeline features.