IDS peak ICV v1.1.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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
DebayerChannelLayout _channel_layout_from_output_pixelformat (self, PixelFormat output_pixel_format)
 
bool _has_rgb_channels (self, PixelFormat pixel_format)
 

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)
 
 _transformation_module = TransformationModule()
 
 _mirror_feature = MirrorFeature(self._transformation_module)
 
 _rotation_feature = RotationFeature(self._transformation_module)
 
None|IAutoFeature _auto_feature_module = None
 
 _modules
 

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.
  10. Auto Features – Optionally applies dynamic adjustments for example auto brightness or auto white balance. 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, DebayerModule "debayering" is automatically applied.
  • If a monochrome image is input and the output format is RGB, the Debayer Module 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: Debayer, Mono conversion, Sharpening and Gamma.
  • The Pixel Format Conversion module 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. For more information, have a look at the specific pipeline modules "process" methods.

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.2f
pipeline.gamma.value = 2.2f

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 36 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 124 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 614 of file default_pipeline.py.

◆ _has_rgb_channels()

bool _has_rgb_channels ( self,
PixelFormat pixel_format )
protected

Definition at line 633 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

Reimplemented from PipelineBase.

Definition at line 597 of file default_pipeline.py.

◆ autofeature_module() [1/2]

IAutoFeature | None autofeature_module ( self)

The used auto feature module.

Definition at line 562 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 570 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 526 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 437 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 541 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 407 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

Reimplemented from IPipeline.

Definition at line 199 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 422 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 392 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 481 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
CorruptedExceptionIf the version or type is invalid.
NotPossibleExceptionIf required module settings are missing.
Since
ids_peak_icv 1.0

Reimplemented from IPipeline.

Definition at line 244 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 496 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 331 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 341 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.

Parameters
imageInput image to be processed.
Returns
Processed image result.
Since
ids_peak_icv 1.0

Reimplemented from PipelineBase.

Definition at line 183 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 307 of file default_pipeline.py.

◆ processing_policy() [2/2]

None processing_policy ( self,
ProcessingPolicy policy )

Defines the processing policy for the pipeline.

Parameters
policyDesired processing policy.
Since
ids_peak_icv 1.0

Definition at line 317 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.

Since
ids_peak_icv 1.0

Reimplemented from IPipeline.

Definition at line 293 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 511 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 451 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 466 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

Reimplemented from IPipeline.

Definition at line 174 of file default_pipeline.py.

◆ version()

int version ( self)

The pipeline version as an integer.

Since
ids_peak_icv 1.0

Definition at line 164 of file default_pipeline.py.

Field Documentation

◆ _auto_feature_module

_auto_feature_module = None
protected

Definition at line 161 of file default_pipeline.py.

◆ _binning_feature

_binning_feature = BinningFeature(self._binning_module)
protected

Definition at line 154 of file default_pipeline.py.

◆ _binning_module

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

Definition at line 134 of file default_pipeline.py.

◆ _color_correction_feature

_color_correction_feature = ColorCorrectionFeature(self._color_matrix_transformation_module)
protected

Definition at line 150 of file default_pipeline.py.

◆ _color_matrix_transformation_module

_color_matrix_transformation_module = ColorMatrixTransformationModule()
protected

Definition at line 144 of file default_pipeline.py.

◆ _debayer_module

_debayer_module = DebayerModule()
protected

Definition at line 136 of file default_pipeline.py.

◆ _decimation_feature

_decimation_feature = DecimationFeature(self._decimation_module)
protected

Definition at line 155 of file default_pipeline.py.

◆ _decimation_module

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

Definition at line 135 of file default_pipeline.py.

◆ _digital_black_feature

_digital_black_feature = DigitalBlackFeature(self._tone_curve_correction_module)
protected

Definition at line 148 of file default_pipeline.py.

◆ _final_conversion_module

_final_conversion_module = PixelFormatConversionModule()
protected

Definition at line 140 of file default_pipeline.py.

◆ _gain_feature

_gain_feature = GainFeature(self._gain_module)
protected

Definition at line 149 of file default_pipeline.py.

◆ _gain_module

_gain_module = GainModule()
protected

Definition at line 143 of file default_pipeline.py.

◆ _gamma_feature

_gamma_feature = GammaFeature(self._tone_curve_correction_module)
protected

Definition at line 147 of file default_pipeline.py.

◆ _hotpixel_correction_feature

_hotpixel_correction_feature = HotpixelCorrectionFeature(self._hotpixel_correction_module)
protected

Definition at line 153 of file default_pipeline.py.

◆ _hotpixel_correction_module

_hotpixel_correction_module = HotpixelCorrectionModule()
protected

Definition at line 133 of file default_pipeline.py.

◆ _mirror_feature

_mirror_feature = MirrorFeature(self._transformation_module)
protected

Definition at line 158 of file default_pipeline.py.

◆ _modules [1/3]

_modules
protected

Definition at line 227 of file default_pipeline.py.

◆ _modules [2/3]

str _modules = module.type

Definition at line 285 of file default_pipeline.py.

◆ _modules [3/3]

bool _modules = True

Definition at line 300 of file default_pipeline.py.

◆ _mono_conversion_module

_mono_conversion_module = mono_conversion_module
protected

Definition at line 139 of file default_pipeline.py.

◆ _processing_policy

_processing_policy = ProcessingPolicy.BALANCED
protected

Definition at line 131 of file default_pipeline.py.

◆ _rotation_feature

_rotation_feature = RotationFeature(self._transformation_module)
protected

Definition at line 159 of file default_pipeline.py.

◆ _saturation_feature

_saturation_feature = SaturationFeature(self._color_matrix_transformation_module)
protected

Definition at line 151 of file default_pipeline.py.

◆ _sharpening_feature

_sharpening_feature = SharpeningFeature(self._sharpening_module)
protected

Definition at line 152 of file default_pipeline.py.

◆ _sharpening_module

_sharpening_module = SharpeningModule()
protected

Definition at line 145 of file default_pipeline.py.

◆ _tone_curve_correction_module

_tone_curve_correction_module = ToneCurveCorrectionModule()
protected

Definition at line 142 of file default_pipeline.py.

◆ _transformation_module

_transformation_module = TransformationModule()
protected

Definition at line 157 of file default_pipeline.py.

◆ _unpack_module

_unpack_module = UnpackModule()
protected

Definition at line 132 of file default_pipeline.py.

◆ version

version

Definition at line 277 of file default_pipeline.py.