IDS peak ICV v1.1.0
Loading...
Searching...
No Matches
DefaultPipeline Class Referencefinal

#include <peak_icv/pipeline/peak_icv_default_pipeline.hpp>

Inheritance diagram for DefaultPipeline:

Public Member Functions

 DefaultPipeline ()
 Creates a DefaultPipeline with default module settings.
 
 ~DefaultPipeline () override
 
std::string ExportSettingsToString () const override
 Converts the current pipeline settings into a string format.
 
void ImportSettingsFromString (const std::string &settings) override
 Restores pipeline settings from a previously serialized string.
 
void ResetToDefault () override
 Resets all modules in the pipeline to their default state. Also resets their enabled state.
 
const char * GetType () const override
 
peak::icv::Image Process (const peak::icv::Image &image) const
 Applies the pipeline to the given image and returns the result as a new image.
 
peak::icv::Image Process (const peak::common::IImageView &imageView) const
 Applies the pipeline to an image view and returns the result as a new image.
 
peak::icv::Image operator<< (const peak::icv::Image &image) const
 Convenience operator for processing input using the pipeline.
 
peak::icv::Image operator<< (const peak::common::IImageView &imageView) const
 Convenience operator for processing input using the pipeline.
 
void ReleaseBuffers () const
 Frees unused internal buffers.
 
features::MirrorFeature & Mirror () const
 Provides access to the mirror feature for image mirroring operations.
 
features::RotationFeature & Rotation () const
 Provides access to the rotation feature for image rotation operations.
 
features::GainFeature & Gain () const
 Provides access to the gain feature for brightness and white balance adjustments.
 
features::ColorCorrectionFeature & ColorCorrection () const
 Provides access to the color correction feature for color space transformations.
 
features::SaturationFeature & Saturation () const
 Provides access to the saturation feature for color intensity adjustments.
 
features::GammaFeature & Gamma () const
 Provides access to the gamma feature for brightness and contrast adjustments.
 
features::DigitalBlackFeature & DigitalBlack () const
 Provides access to the digital black feature for sensor offset correction.
 
features::SharpeningFeature & Sharpening () const
 Provides access to the sharpening feature for image detail enhancement.
 
features::HotpixelCorrectionFeature & HotpixelCorrection () const
 Provides access to the hot pixel correction feature for defective pixel repair.
 
features::BinningFeature & Binning () const
 Provides access to the binning feature for resolution reduction and noise improvement.
 
features::DecimationFeature & Decimation () const
 Provides access to the decimation feature for resolution reduction by pixel skipping.
 
void SetOutputPixelFormat (peak::common::PixelFormat format)
 Defines the desired pixel format for processed images.
 
peak::common::PixelFormat GetOutputPixelFormat () const
 
void SetProcessingPolicy (ProcessingPolicy policy)
 Sets the processing policy for the image processing pipeline.
 
ProcessingPolicy GetProcessingPolicy () const
 
void SetAutoFeatureModule (const std::shared_ptr< modules::IAutoFeature > &autoFeatureModule)
 Sets an auto feature module for automatic image adjustments.
 
void ExportSettingsToFile (const std::string &filePath) const override
 Saves the current settings of the pipeline and its modules to a file.
 
void ImportSettingsFromFile (const std::string &filePath) override
 Loads the settings of the pipeline and its modules from a file.
 

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.
    • 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. Color Correction – Applies a color correction matrix.
  10. Auto Features – Optionally applies 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 autoFeatureModule = std::make_shared<peak::pipeline::modules::AutoFeatureModule>(remoteDeviceNodeMap);
      pipeline.SetAutoFeatureModule(autoFeatureModule);

      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 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
  • 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.SetOutputPixelFormat(PixelFormat::RGB8);
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().SetMaster(1.2f);
    pipeline.Gamma().SetValue(2.2f);
  • Settings File: Load or save all configuration settings:
    pipeline.ImportSettingsFromFile("config.json");
    pipeline.ExportSettingsToFile("config.json");
  • Reset to Defaults: Restore the pipeline to its default configuration:
    pipeline.ResetToDefault();

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 264 of file peak_icv_default_pipeline.hpp.

Constructor & Destructor Documentation

◆ DefaultPipeline()

DefaultPipeline ( )
inline

Creates a DefaultPipeline with default module settings.

Initializes all internal modules to their default configuration.

Since
ids_peak_icv 1.0

Definition at line 652 of file peak_icv_default_pipeline.hpp.

◆ ~DefaultPipeline()

~DefaultPipeline ( )
inlineoverride
Since
ids_peak_icv 1.0

Definition at line 665 of file peak_icv_default_pipeline.hpp.

Member Function Documentation

◆ Binning()

features::BinningFeature & Binning ( ) const
inline

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 binning feature.
Since
ids_peak_icv 1.0

Definition at line 837 of file peak_icv_default_pipeline.hpp.

◆ ColorCorrection()

features::ColorCorrectionFeature & ColorCorrection ( ) const
inline

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 807 of file peak_icv_default_pipeline.hpp.

◆ Decimation()

features::DecimationFeature & Decimation ( ) const
inline

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.

Returns
A reference to the decimation feature.
Since
ids_peak_icv 1.0

Definition at line 842 of file peak_icv_default_pipeline.hpp.

◆ DigitalBlack()

features::DigitalBlackFeature & DigitalBlack ( ) const
inline

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 822 of file peak_icv_default_pipeline.hpp.

◆ ExportSettingsToFile()

void ExportSettingsToFile ( const std::string & filePath) const
inlineoverridevirtualinherited

Saves the current settings of the pipeline and its modules to a file.

This base implementation calls ExportSettingsToString() and writes the resulting string to the specified file path.

Parameters
filePathPath to the file where the settings should be saved.
Since
ids_peak_common 1.0

Implements IPipeline.

Definition at line 77 of file peak_common_pipeline_base.hpp.

◆ ExportSettingsToString()

std::string ExportSettingsToString ( ) const
inlineoverridevirtual

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.

Returns
A string representation of the pipeline's current configuration state.
Since
ids_peak_icv 1.0

Implements IPipeline.

Definition at line 673 of file peak_icv_default_pipeline.hpp.

◆ Gain()

features::GainFeature & Gain ( ) const
inline

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 802 of file peak_icv_default_pipeline.hpp.

◆ Gamma()

features::GammaFeature & Gamma ( ) const
inline

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 817 of file peak_icv_default_pipeline.hpp.

◆ GetOutputPixelFormat()

peak::common::PixelFormat GetOutputPixelFormat ( ) const
inline
Returns
The current output pixel format as a PixelFormat enum.
Since
ids_peak_icv 1.0

Definition at line 920 of file peak_icv_default_pipeline.hpp.

◆ GetProcessingPolicy()

ProcessingPolicy GetProcessingPolicy ( ) const
inline
Returns
The currently used processing policy.
Since
ids_peak_icv 1.0

Definition at line 579 of file peak_icv_default_pipeline.hpp.

◆ GetType()

const char * GetType ( ) const
inlineoverridevirtual
Returns
The pipeline type identifier as a string, primarily used for serialization.
Since
ids_peak_icv 1.0

Implements IPipeline.

Definition at line 779 of file peak_icv_default_pipeline.hpp.

◆ HotpixelCorrection()

features::HotpixelCorrectionFeature & HotpixelCorrection ( ) const
inline

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 832 of file peak_icv_default_pipeline.hpp.

◆ ImportSettingsFromFile()

void ImportSettingsFromFile ( const std::string & filePath)
inlineoverridevirtualinherited

Loads the settings of the pipeline and its modules from a file.

This base implementation reads the file contents and passes them to ImportSettingsFromString() to restore the pipeline state.

Parameters
filePathPath to the file from which settings should be loaded.
Since
ids_peak_common 1.0

Implements IPipeline.

Definition at line 94 of file peak_common_pipeline_base.hpp.

◆ ImportSettingsFromString()

void ImportSettingsFromString ( const std::string & settings)
inlineoverridevirtual

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.

Parameters
settingsA string containing the serialized pipeline configuration.
Since
ids_peak_icv 1.0

Implements IPipeline.

Definition at line 707 of file peak_icv_default_pipeline.hpp.

◆ Mirror()

features::MirrorFeature & Mirror ( ) const
inline

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 792 of file peak_icv_default_pipeline.hpp.

◆ operator<<() [1/2]

peak::icv::Image operator<< ( const peak::common::IImageView & imageView) const
inline

Convenience operator for processing input using the pipeline.

Equivalent to calling Process.

Parameters
imageViewThe image view 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 915 of file peak_icv_default_pipeline.hpp.

◆ operator<<() [2/2]

peak::icv::Image operator<< ( const peak::icv::Image & image) const
inline

Convenience operator for processing input using the pipeline.

Equivalent to calling Process.

Parameters
imageThe 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 910 of file peak_icv_default_pipeline.hpp.

◆ Process() [1/2]

peak::icv::Image Process ( const peak::common::IImageView & imageView) const
inline

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

Internally, the image view is converted into an Image before processing.

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

Note
This operation disregards any specified image regions and processes the entire image.
Parameters
imageViewThe image view 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 905 of file peak_icv_default_pipeline.hpp.

◆ Process() [2/2]

peak::icv::Image Process ( const peak::icv::Image & image) const
inline

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.

Note
This operation disregards any specified image regions and processes the entire image.
Parameters
imageThe 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 900 of file peak_icv_default_pipeline.hpp.

◆ ReleaseBuffers()

void ReleaseBuffers ( ) const
inline

Frees unused internal buffers.

Conversion modules use pre-allocated internal buffers to accelerate conversions. When the image size or pixel format changes, new buffers are allocated, which may cause the internal buffer pool to grow over time. This function can be used to release unused buffers and reduce memory usage.

Warning
Avoid calling this function too frequently (e.g., after every resize or format change), as it introduces some overhead and may negatively impact performance.
Since
ids_peak_icv 1.0

Definition at line 784 of file peak_icv_default_pipeline.hpp.

◆ ResetToDefault()

void ResetToDefault ( )
inlineoverridevirtual

Resets all modules in the pipeline to their default state. Also resets their enabled state.

Since
ids_peak_icv 1.0

Implements IPipeline.

Definition at line 764 of file peak_icv_default_pipeline.hpp.

◆ Rotation()

features::RotationFeature & Rotation ( ) const
inline

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 797 of file peak_icv_default_pipeline.hpp.

◆ Saturation()

features::SaturationFeature & Saturation ( ) const
inline

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 812 of file peak_icv_default_pipeline.hpp.

◆ SetAutoFeatureModule()

void SetAutoFeatureModule ( const std::shared_ptr< modules::IAutoFeature > & autoFeatureModule)
inline

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
autoFeatureModuleThe auto feature module.
Since
ids_peak_icv 1.0

Definition at line 994 of file peak_icv_default_pipeline.hpp.

◆ SetOutputPixelFormat()

void SetOutputPixelFormat ( peak::common::PixelFormat format)
inline

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
formatThe new pixel format as a PixelFormat enum.
See also
GetOutputPixelFormat(), features::ColorCorrectionFeature, features::GammaFeature, features::SharpeningFeature
Since
ids_peak_icv 1.0

Definition at line 925 of file peak_icv_default_pipeline.hpp.

◆ SetProcessingPolicy()

void SetProcessingPolicy ( ProcessingPolicy policy)
inline

Sets the processing policy for the image processing 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
policyThe desired processing policy.
Since
ids_peak_icv 1.0

Definition at line 986 of file peak_icv_default_pipeline.hpp.

◆ Sharpening()

features::SharpeningFeature & Sharpening ( ) const
inline

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 827 of file peak_icv_default_pipeline.hpp.