IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
DefaultPipeline Class Reference
Inheritance diagram for DefaultPipeline:

Public Member Functions

None __init__ (self)
 Initializes all internal modules to their default configuration.
 
int version (self)
 The pipeline version as an integer.
 
str type (self)
 The pipeline type identifier as a string, primarily used for serialization.
 
Image process (self, Union[Image, IImageView] image)
 Applies the pipeline to the given image and returns the result as a new image.
 
str export_settings_to_string (self)
 Converts the current pipeline settings into a string format.
 
None import_settings_from_string (self, str settings)
 Restores pipeline settings from a previously serialized string.
 
None reset_to_default (self)
 Resets all modules in the pipeline to their default state.
 
ProcessingPolicy processing_policy (self)
 The currently used processing policy.
 
None processing_policy (self, ProcessingPolicy policy)
 Defines the processing policy for the pipeline.
 
PixelFormat output_pixel_format (self)
 The current output pixel format as a PixelFormat enum.
 
None output_pixel_format (self, PixelFormat output_pixel_format)
 Defines the desired pixel format for processed images.
 
MirrorFeature mirror (self)
 Provides access to the mirror feature for image mirroring operations.
 
RotationFeature rotation (self)
 Provides access to the rotation feature for image rotation operations.
 
GainFeature gain (self)
 Provides access to the gain feature for brightness and white balance adjustments.
 
ColorCorrectionFeature color_correction (self)
 Provides access to the color correction feature for color space transformations.
 
SaturationFeature saturation (self)
 Provides access to the saturation feature for color intensity adjustments.
 
GammaFeature gamma (self)
 Provides access to the gamma feature for brightness and contrast adjustments.
 
DigitalBlackFeature digital_black (self)
 Provides access to the digital black feature for sensor offset correction.
 
SharpeningFeature sharpening (self)
 Provides access to the sharpening feature for image detail enhancement.
 
HotpixelCorrectionFeature hotpixel_correction (self)
 Provides access to the hot pixel correction feature for defective pixel repair.
 
BinningFeature binning (self)
 Provides access to the binning feature for resolution reduction and noise improvement.
 
DecimationFeature decimation (self)
 Provides access to the decimation feature for resolution reduction by pixel skipping.
 
ChromaticAdaptionFeature chromatic_adaption (self)
 Provides access to the chromatic adaption feature for adjusting to lighting conditions.
 
IAutoFeature|None autofeature_module (self)
 The used auto feature module.
 
None autofeature_module (self, IAutoFeature|None auto_feature_module)
 Sets an auto feature module for automatic image adjustments.
 

Data Fields

 version
 
str _modules = module.type
 
bool _modules = True
 

Protected Member Functions

tuple[IModule,...] _modules (self)
 Retrieves the sequence of processing modules for the pipeline in execution order.
 
tuple[IFeature,...] _features (self)
 
DebayerChannelLayout _channel_layout_from_output_pixelformat (self, PixelFormat output_pixel_format)
 
bool _has_rgb_channels (self, PixelFormat pixel_format)
 

Static Protected Member Functions

Image _copy_image_buffer_if_same_buffer (Image|IImageView original_image, Image processed_image)
 

Protected Attributes

ProcessingPolicy _processing_policy = ProcessingPolicy.BALANCED
 
 _unpack_module = UnpackModule()
 
 _hotpixel_correction_module = HotpixelCorrectionModule()
 
 _binning_module = DownsamplingModule(DownsamplingMode.BinningAverage, "Binning")
 
 _decimation_module = DownsamplingModule(DownsamplingMode.Decimation, "Decimation")
 
 _debayer_module = DebayerModule()
 
 _mono_conversion_module = mono_conversion_module
 
 _final_conversion_module = PixelFormatConversionModule()
 
 _tone_curve_correction_module = ToneCurveCorrectionModule()
 
 _gain_module = GainModule()
 
 _color_matrix_transformation_module = ColorMatrixTransformationModule()
 
 _sharpening_module = SharpeningModule()
 
 _gamma_feature = GammaFeature(self._tone_curve_correction_module)
 
 _digital_black_feature = DigitalBlackFeature(self._tone_curve_correction_module)
 
 _gain_feature = GainFeature(self._gain_module)
 
 _color_correction_feature = ColorCorrectionFeature(self._color_matrix_transformation_module)
 
 _saturation_feature = SaturationFeature(self._color_matrix_transformation_module)
 
 _sharpening_feature = SharpeningFeature(self._sharpening_module)
 
 _hotpixel_correction_feature = HotpixelCorrectionFeature(self._hotpixel_correction_module)
 
 _binning_feature = BinningFeature(self._binning_module)
 
 _decimation_feature = DecimationFeature(self._decimation_module)
 
 _chromatic_adaption_feature = ChromaticAdaptionFeature(self._color_matrix_transformation_module)
 
 _transformation_module = TransformationModule()
 
 _mirror_feature = MirrorFeature(self._transformation_module)
 
 _rotation_feature = RotationFeature(self._transformation_module)
 
None|IAutoFeature _auto_feature_module = None
 
 _modules
 
 _features
 

Detailed Description

Image processing pipeline for sequential transformation of raw image frames.

The Pipeline class performs a series of configurable image processing steps on raw or pre-processed image data. It is designed to support a complete transformation workflow, from raw sensor input to final output format, with each stage modular and optionally enabled or configured.

Processing Steps

  1. Unpack (Always Active) – Automatically unpacks packed sensor data formats. This stage is internal and cannot be configured.
  2. Hot Pixel Correction – Identifies and corrects defective pixels (hot pixels).
  3. Binning – Reduces resolution and improves signal-to-noise ratio by combining adjacent pixels.
  4. Decimation – Downscales the image by skipping pixels in a defined pattern.
  5. Mirror – Optionally mirrors the image left-right and/or up-down.
  6. Rotation – Rotates the image by 90, 180, or 270 degrees.
  7. Gain – Applies digital master gain to control image brightness, or digital color gains to adjust white balance.
  8. Debayer (Configured Internally) - Converts Bayer pattern raw data to RGB format and expands monochrome images to RGB when a color output format is requested. This behavior is automatically determined based on the input and output pixel formats.
  9. ColorCorrection – Applies a color correction matrix, saturation and chromatic adaption.
  10. Auto Features – Analyzes the image for the following dynamic adjustments:

    • Auto Brightness
    • Auto White Balance
    • Auto Focus (if supported by the device)

    To enable Auto Features, an external module must be provided via::

    auto_feature_module = AutoFeatureModule(remote_device_node_map)
    pipeline.auto_feature_module = auto_feature_module
    

    This module is part of the Auto Feature Library (AFL).

  11. Mono conversion (Configured Internally) – Converts RGB images to monochrome when a monochrome output format is requested.
  12. Sharpening – Enhances image detail using edge-based sharpening filters.
  13. Gamma – Applies gamma correction to adjust brightness and contrast.
  14. Pixel Format Conversion (Configured Internally) – Converts the processed image to the desired output pixel format.

Smart Pixel Format Configuration Inference

The pipeline includes built-in logic to automatically configure certain internal stages based on the input and output formats. For example:

  • If a Bayer image is provided and the output format is RGB, debayering is automatically applied.
  • If a monochrome image is input and the output format is RGB, the DebayerModule takes over the mono-to-RGB expansion.
  • If the output format is monochrome, mono conversion is enabled.
  • If a Bayer pixel format is set as output format, the following features or modules are not processing:
    • DebayerModule,
    • MonoConversionModule,
    • SharpeningFeature and
    • GammaFeature.
  • The PixelFormatConversionModule is responsible for converting to the specified output format. If necessary, the bit depth is reduced during this step.

Use the following method to set the desired final pixel format::

pipeline.output_pixel_format = PixelFormat.RGB_8
Note
There might be cases where some modules, even though they are enabled, do not apply their configuration, if the pixel format is not supported. Further information can be found in the documentation of the individual "process" methods for each module.

Configuration

The pipeline can be configured in two ways:

Module Access: Each configurable processing module can be accessed directly, allowing individual configuration::

pipeline.gain.master = 1.2
pipeline.gamma.value = 2.2

Settings File: Load or save all configuration settings::

pipeline.import_settings_from_file("config.json")
pipeline.export_settings_to_file("config.json")

This modular and extensible design enables flexible integration into a variety of image processing applications, from camera pipelines to offline image editing.

Since
ids_peak_icv 1.0

Definition at line 37 of file default_pipeline.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self)

Initializes all internal modules to their default configuration.

Since
ids_peak_icv 1.0

Definition at line 156 of file default_pipeline.py.

Member Function Documentation

◆ _channel_layout_from_output_pixelformat()

DebayerChannelLayout _channel_layout_from_output_pixelformat ( self,
PixelFormat output_pixel_format )
protected

Definition at line 713 of file default_pipeline.py.

◆ _copy_image_buffer_if_same_buffer()

Image _copy_image_buffer_if_same_buffer ( Image | IImageView original_image,
Image processed_image )
staticprotected

Definition at line 247 of file default_pipeline.py.

◆ _features()

tuple[IFeature, ...] _features ( self)
protected

Definition at line 707 of file default_pipeline.py.

◆ _has_rgb_channels()

bool _has_rgb_channels ( self,
PixelFormat pixel_format )
protected

Definition at line 732 of file default_pipeline.py.

◆ _modules()

tuple[IModule, ...] _modules ( self)
protected

Retrieves the sequence of processing modules for the pipeline in execution order.

Returns
Sequence of pipeline modules.
Since
ids_peak_icv 1.0

Definition at line 689 of file default_pipeline.py.

◆ autofeature_module() [1/2]

IAutoFeature | None autofeature_module ( self)

The used auto feature module.

Definition at line 654 of file default_pipeline.py.

◆ autofeature_module() [2/2]

None autofeature_module ( self,
IAutoFeature | None auto_feature_module )

Sets an auto feature module for automatic image adjustments.

These adjustments can include features such as image brightness, white balance, and focus, depending on the capabilities of the provided module.

Note
If there is no auto feature module specified, this step will be skipped during processing.
Parameters
auto_feature_moduleThe auto feature module.

Definition at line 662 of file default_pipeline.py.

◆ binning()

BinningFeature binning ( self)

Provides access to the binning feature for resolution reduction and noise improvement.

The binning feature reduces image resolution by combining adjacent pixels through averaging or summation, improving signal-to-noise ratio at the cost of resolution.

Returns
A reference to the BinningFeature.
Since
ids_peak_icv 1.0

Definition at line 603 of file default_pipeline.py.

◆ chromatic_adaption()

ChromaticAdaptionFeature chromatic_adaption ( self)

Provides access to the chromatic adaption feature for adjusting to lighting conditions.

The chromatic adaption feature adjusts the image's colors based on the known or estimated correlated color temperature of the light source, maintaining consistent color perception.

Returns
A reference to the chromatic adaption feature.
Since
ids_peak_icv 1.3

Definition at line 635 of file default_pipeline.py.

◆ color_correction()

ColorCorrectionFeature color_correction ( self)

Provides access to the color correction feature for color space transformations.

The color correction feature applies a 3x3 transformation matrix to perform color balancing.

Returns
A reference to the color correction feature.
Since
ids_peak_icv 1.0

Definition at line 513 of file default_pipeline.py.

◆ decimation()

DecimationFeature decimation ( self)

Provides access to the decimation feature for resolution reduction by pixel skipping.

The decimation feature reduces image resolution by skipping pixels in a defined pattern, providing a faster alternative to binning for resolution reduction.

A reference to the DecimationFeature.

Returns
A reference to the DecimationFeature.
Since
ids_peak_icv 1.0

Definition at line 618 of file default_pipeline.py.

◆ digital_black()

DigitalBlackFeature digital_black ( self)

Provides access to the digital black feature for sensor offset correction.

The digital black feature compensates for sensor digital black offsets by subtracting a configurable black level and normalizing the result.

Returns
A reference to the digital black feature.
Since
ids_peak_icv 1.0

Definition at line 558 of file default_pipeline.py.

◆ export_settings_to_string()

str export_settings_to_string ( self)

Converts the current pipeline settings into a string format.

Serializes all relevant configuration parameters of the pipeline into a single string, which can be stored or transferred for later use.

The export includes:

  • Pipeline version
  • Pipeline type
  • Creation timestamp (ISO UTC)
  • All module settings (type + serialized data)
Returns
A string representation of the pipeline's current configuration state.
Since
ids_peak_icv 1.0

Definition at line 258 of file default_pipeline.py.

◆ gain()

GainFeature gain ( self)

Provides access to the gain feature for brightness and white balance adjustments.

The gain feature allows adjustment of master gain (overall brightness) and individual color channel gains (red, green, blue) for white balance correction.

Returns
A reference to the gain feature.
Since
ids_peak_icv 1.0

Definition at line 498 of file default_pipeline.py.

◆ gamma()

GammaFeature gamma ( self)

Provides access to the gamma feature for brightness and contrast adjustments.

The gamma feature applies inverse gamma correction to adjust image luminance, preparing images for linear domain processing or display.

Returns
A reference to the gamma feature.
Since
ids_peak_icv 1.0

Definition at line 543 of file default_pipeline.py.

◆ hotpixel_correction()

HotpixelCorrectionFeature hotpixel_correction ( self)

Provides access to the hot pixel correction feature for defective pixel repair.

The hot pixel correction feature identifies and corrects defective pixels (hot pixels) in camera images by replacing them with interpolated values from neighboring pixels.

Returns
A reference to the hotpixel correction feature.
Since
ids_peak_icv 1.0

Definition at line 588 of file default_pipeline.py.

◆ import_settings_from_string()

None import_settings_from_string ( self,
str settings )

Restores pipeline settings from a previously serialized string.

Parses the provided string and applies the contained configuration values to update the internal state of the pipeline accordingly.

This includes:

  • Validation of version (must be >= 1).
  • Validation of pipeline type (must match this pipeline).
  • Restoring each module's settings by invoking its deserialize method.
Parameters
settingsA string containing the serialized pipeline configuration.
Exceptions
NotPossibleExceptionIf the type is invalid.
NotSupportedExceptionIf the version is invalid.
CorruptedExceptionIf required module settings are missing.
Since
ids_peak_icv 1.0

Definition at line 303 of file default_pipeline.py.

◆ mirror()

MirrorFeature mirror ( self)

Provides access to the mirror feature for image mirroring operations.

The mirror feature allows horizontal (left-right) and vertical (up-down) mirroring of images during pipeline processing.

Returns
A reference to the mirror feature.
Since
ids_peak_icv 1.0

Definition at line 468 of file default_pipeline.py.

◆ output_pixel_format() [1/2]

PixelFormat output_pixel_format ( self)

The current output pixel format as a PixelFormat enum.

Since
ids_peak_icv 1.0

Definition at line 407 of file default_pipeline.py.

◆ output_pixel_format() [2/2]

None output_pixel_format ( self,
PixelFormat output_pixel_format )

Defines the desired pixel format for processed images.

The pipeline will convert images to this format during processing.

Warning
When set to a Bayer format, the ColorCorrection, Gamma and Sharpening features will not process the image because they do not support Bayer formats. This may result in unexpected image quality if these features are enabled.
Parameters
output_pixel_formatThe new pixel format as a PixelFormat enum.
Since
ids_peak_icv 1.0

Definition at line 417 of file default_pipeline.py.

◆ process()

Image process ( self,
Union[Image, IImageView] image )

Applies the pipeline to the given image and returns the result as a new image.

The returned image is always a new instance. If no processing is applied, it will be a deep copy of the input.

Warning
The input image may be modified during execution due to in-place operations. If you need to preserve the original image, create a copy before calling this function.
Note
This operation disregards any specified image regions and processes the entire image.
Parameters
imageInput image to be processed.
Returns
A new image containing the processed input or a deep copy of the input.
Since
ids_peak_icv 1.0

Definition at line 216 of file default_pipeline.py.

◆ processing_policy() [1/2]

ProcessingPolicy processing_policy ( self)

The currently used processing policy.

Since
ids_peak_icv 1.0

Definition at line 376 of file default_pipeline.py.

◆ processing_policy() [2/2]

None processing_policy ( self,
ProcessingPolicy policy )

Defines the processing policy for the pipeline.

This policy determines the trade-off between processing speed and image quality throughout the entire pipeline.

  • Fast: Prioritizes processing speed, which may reduce image quality.
  • Balanced: Balances processing speed and image quality for typical use cases.
  • Enhanced: Prioritizes improved image quality at the cost of reduced processing speed.
Parameters
policyDesired processing policy.
Since
ids_peak_icv 1.0

Definition at line 386 of file default_pipeline.py.

◆ reset_to_default()

None reset_to_default ( self)

Resets all modules in the pipeline to their default state.

Also resets their enabled state.

In addition, this also resets the pipelines internal properties to default:

  • ProcessingPolicy to ProcessingPolicy.Fast
Since
ids_peak_icv 1.0

Definition at line 353 of file default_pipeline.py.

◆ rotation()

RotationFeature rotation ( self)

Provides access to the rotation feature for image rotation operations.

The rotation feature allows rotating images in 90-degree increments (0°, 90°, 180°, 270°) during pipeline processing.

Returns
A reference to the rotation feature.
Since
ids_peak_icv 1.0

Definition at line 483 of file default_pipeline.py.

◆ saturation()

SaturationFeature saturation ( self)

Provides access to the saturation feature for color intensity adjustments.

The saturation feature allows adjustment of color saturation levels, making colors more vivid (higher saturation) or more muted (lower saturation).

Returns
A reference to the saturation feature.
Since
ids_peak_icv 1.0

Definition at line 528 of file default_pipeline.py.

◆ sharpening()

SharpeningFeature sharpening ( self)

Provides access to the sharpening feature for image detail enhancement.

The sharpening feature applies edge-based sharpening filters to enhance image detail and improve perceived image sharpness.

Returns
A reference to the sharpening feature.
Since
ids_peak_icv 1.0

Definition at line 573 of file default_pipeline.py.

◆ type()

str type ( self)

The pipeline type identifier as a string, primarily used for serialization.

Since
ids_peak_icv 1.0

Definition at line 207 of file default_pipeline.py.

◆ version()

int version ( self)

The pipeline version as an integer.

Since
ids_peak_icv 1.0

Definition at line 197 of file default_pipeline.py.

Field Documentation

◆ _auto_feature_module

_auto_feature_module = None
protected

Definition at line 194 of file default_pipeline.py.

◆ _binning_feature

_binning_feature = BinningFeature(self._binning_module)
protected

Definition at line 186 of file default_pipeline.py.

◆ _binning_module

_binning_module = DownsamplingModule(DownsamplingMode.BinningAverage, "Binning")
protected

Definition at line 166 of file default_pipeline.py.

◆ _chromatic_adaption_feature

_chromatic_adaption_feature = ChromaticAdaptionFeature(self._color_matrix_transformation_module)
protected

Definition at line 188 of file default_pipeline.py.

◆ _color_correction_feature

_color_correction_feature = ColorCorrectionFeature(self._color_matrix_transformation_module)
protected

Definition at line 182 of file default_pipeline.py.

◆ _color_matrix_transformation_module

_color_matrix_transformation_module = ColorMatrixTransformationModule()
protected

Definition at line 176 of file default_pipeline.py.

◆ _debayer_module

_debayer_module = DebayerModule()
protected

Definition at line 168 of file default_pipeline.py.

◆ _decimation_feature

_decimation_feature = DecimationFeature(self._decimation_module)
protected

Definition at line 187 of file default_pipeline.py.

◆ _decimation_module

_decimation_module = DownsamplingModule(DownsamplingMode.Decimation, "Decimation")
protected

Definition at line 167 of file default_pipeline.py.

◆ _digital_black_feature

_digital_black_feature = DigitalBlackFeature(self._tone_curve_correction_module)
protected

Definition at line 180 of file default_pipeline.py.

◆ _features

_features
protected

Definition at line 368 of file default_pipeline.py.

◆ _final_conversion_module

_final_conversion_module = PixelFormatConversionModule()
protected

Definition at line 172 of file default_pipeline.py.

◆ _gain_feature

_gain_feature = GainFeature(self._gain_module)
protected

Definition at line 181 of file default_pipeline.py.

◆ _gain_module

_gain_module = GainModule()
protected

Definition at line 175 of file default_pipeline.py.

◆ _gamma_feature

_gamma_feature = GammaFeature(self._tone_curve_correction_module)
protected

Definition at line 179 of file default_pipeline.py.

◆ _hotpixel_correction_feature

_hotpixel_correction_feature = HotpixelCorrectionFeature(self._hotpixel_correction_module)
protected

Definition at line 185 of file default_pipeline.py.

◆ _hotpixel_correction_module

_hotpixel_correction_module = HotpixelCorrectionModule()
protected

Definition at line 165 of file default_pipeline.py.

◆ _mirror_feature

_mirror_feature = MirrorFeature(self._transformation_module)
protected

Definition at line 191 of file default_pipeline.py.

◆ _modules [1/3]

_modules
protected

Definition at line 286 of file default_pipeline.py.

◆ _modules [2/3]

str _modules = module.type

Definition at line 345 of file default_pipeline.py.

◆ _modules [3/3]

bool _modules = True

Definition at line 364 of file default_pipeline.py.

◆ _mono_conversion_module

_mono_conversion_module = mono_conversion_module
protected

Definition at line 171 of file default_pipeline.py.

◆ _processing_policy

_processing_policy = ProcessingPolicy.BALANCED
protected

Definition at line 163 of file default_pipeline.py.

◆ _rotation_feature

_rotation_feature = RotationFeature(self._transformation_module)
protected

Definition at line 192 of file default_pipeline.py.

◆ _saturation_feature

_saturation_feature = SaturationFeature(self._color_matrix_transformation_module)
protected

Definition at line 183 of file default_pipeline.py.

◆ _sharpening_feature

_sharpening_feature = SharpeningFeature(self._sharpening_module)
protected

Definition at line 184 of file default_pipeline.py.

◆ _sharpening_module

_sharpening_module = SharpeningModule()
protected

Definition at line 177 of file default_pipeline.py.

◆ _tone_curve_correction_module

_tone_curve_correction_module = ToneCurveCorrectionModule()
protected

Definition at line 174 of file default_pipeline.py.

◆ _transformation_module

_transformation_module = TransformationModule()
protected

Definition at line 190 of file default_pipeline.py.

◆ _unpack_module

_unpack_module = UnpackModule()
protected

Definition at line 164 of file default_pipeline.py.

◆ version

version

Definition at line 337 of file default_pipeline.py.