1from __future__
import annotations
12 Color correction applies a 3x3 color correction matrix to the image.
14 @supportedPixelformats{ColorMatrixTransformation}
16 Color correction is typically used to convert colors from a camera sensor’s native RGB space to a standard color space,
17 or to perform color balancing and correction.
19 When performing color correction, a 3x3 color correction matrix is applied to the color values of the image.
21 The color correction matrix is represented as a 3×3 float array::
23 +--------+--------+--------+
24 | m_00 | m_01 | m_02 |
25 +--------+--------+--------+
26 | m_10 | m_11 | m_12 |
27 +--------+--------+--------+
28 | m_20 | m_21 | m_22 |
29 +--------+--------+--------+
31 Each element `m_ij` defines how much of the input channel `j` contributes to the output channel `i`.
32 For example, `m_01` is the contribution of the green input to the red output.
34 The matrix is applied as follows:
36 red_value_out = m_00 * red_value_in + m_01 * green_value_in + m_02 * blue_value_in;
37 green_value_out = m_10 * red_value_in + m_11 * green_value_in + m_12 * blue_value_in;
38 blue_value_out = m_20 * red_value_in + m_21 * green_value_in + m_22 * blue_value_in;
41 where red_value_in, green_value_in, and blue_value_in are the input red, green, and blue channel values, respectively,
42 and red_value_out, green_value_out, and blue_value_out are the corresponding corrected output values.
43 All RGB values are normalized to the range [0.0, 1.0].
45 @warning Improper color correction matrices may result in color shifts, clipping, or unnatural colors.
47 The default value for the color correction matrix is the identity matrix.
49 @since ids_peak_icv 1.0
50 @ingroup ids_peak_icv_python_pipeline_features
53 def __init__(self, module: ColorMatrixTransformationModule) ->
None:
56 Creates a ColorCorrectionFeature for an existing color matrix transformation module.
57 @param module: Reference to the underlying module
59 @since ids_peak_icv 1.0
67 Gets whether this feature is currently enabled.
69 @return True if enabled; otherwise False.
71 @since ids_peak_icv 1.0
73 return self.
_module.color_correction_enabled
79 Enables or disables the feature.
81 @param enabled: True to enable, False to disable.
83 @since ids_peak_icv 1.0
85 self.
_module.color_correction_enabled = enabled
90 Resets the color correction matrix to its default value (identity matrix).
92 @note The enabled state does not change when calling this function.
94 @since ids_peak_icv 1.0
102 Gets the current color correction matrix.
104 @return The current color correction matrix.
106 @since ids_peak_icv 1.0
111 def matrix(self, matrix: numpy.ndarray) ->
None:
114 Sets the color correction matrix.
116 @param matrix: A floating-point 3x3 color correction matrix.
118 @since ids_peak_icv 1.0
Color correction applies a 3x3 color correction matrix to the image.
None reset_to_default(self)
Resets the color correction matrix to its default value (identity matrix).
None __init__(self, ColorMatrixTransformationModule module)
Creates a ColorCorrectionFeature for an existing color matrix transformation module.
bool enabled(self)
Gets whether this feature is currently enabled.
numpy.ndarray matrix(self)
Gets the current color correction matrix.
Abstract base class for all image processing pipeline features.