IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
Image Processing Pipeline

This document describes the image processing pipeline designed to perform a series of operations on raw sensor data to produce optimized, visually accurate, and display-ready images. The pipeline manages unpacking raw input, correcting sensor artifacts, adjusting image properties, and converting pixel formats as needed.

Flexibility is a core aspect of the pipeline’s design. A base pipeline class defines the primary interface and common utilities for image processing pipelines but does not include any predefined sequence of operations. Developers extend this base class to implement custom pipelines tailored to specific application requirements.

In contrast, the default pipeline implementation provides a ready-to-use standard processing sequence, which is described in detail below.

Default Pipeline

The default pipeline provides a complete, modular image processing chain to transform raw sensor data into ready-to-use image formats. It is designed for industrial vision systems where consistent image quality, configurability, and real-time performance are essential.

This pipeline supports a broad range of operations:

  • Unpacking
  • Hotpixel correction
  • Binning/Decimation
  • Mirror/Rotation
  • Gain
  • Debayering
  • Color correction
  • Chromatic adaption
  • Auto features
  • Mono conversion
  • Sharpening
  • Gamma
  • Pixel format conversion

Each stage is configurable to fit application-specific needs. The pipeline’s internal logic activates only relevant steps, minimizing overhead and easing integration.

The default pipeline offers full access to individual features and internal format inference, enabling efficient integration into custom vision solutions.

For advanced scenarios such as adaptive white balance or exposure control, the pipeline integrates seamlessly with the IDS peak AFL.

Recommended Application Scenario

This pipeline is intended for machine vision applications where raw image data from industrial sensors (typically Bayer or Mono) must be processed into a calibrated, standardized output format.

Typical Use Cases:

  • Inline inspection systems (e.g., defect detection)
  • Embedded vision modules in industrial automation

Requirements

The pipeline expects input in the form of a valid image view, which is typically constructed from a buffer supplied by the IDS acquisition backend (IDS peak genericAPI library).

Optionally, the IDS peak AFL library is required for automatic brightness, white balance and focus adjustments.

Example Results

The following images illustrate different stages in a pipeline, where hotpixel correction, gain, color correction and gamma are enabled. The input is a bayered image, the output format is RGB.

Source Hotpixel Correction Gain
Source image Hotpixel corrected image Gain corrected image
Debayering Color Correction Gamma
Debayered image Color corrected image Tone curve corrected image

Usage Instructions

This section introduces the core features of the image processing pipeline. It explains how to use default settings, customize individual stages, load and save configurations, and enable advanced auto features. You’ll also learn about setting output formats and managing processing policies to optimize performance and image quality.

Basic Usage with Default Settings

The simplest way to use the pipeline is to create it with the default settings and then process an image view constructed from a IDS peak genericAPI buffer. This will produce a color image in the RGB8 format, which represents an 8-bit per channel RGB image.

For example, after constructing the pipeline, you can pass an image view containing raw sensor data to it and receive a color image as output.

  • C++
    // Initialize pipeline with default settings
    //
    // Get a buffer from IDS peak genericAPI
    std::shared_ptr<peak::core::Buffer> buffer = dataStream->WaitForFinishedBuffer(5'000);
    //
    // Process the image view constructed from an acquisition buffer
    peak::icv::Image image = pipeline.Process(buffer->ToImageView());
  • C#
    // Initialize pipeline with default settings
    using var pipeline = new DefaultPipeline();
    //
    // Get a buffer from IDS peak genericAPI
    using var buffer = dataStream.WaitForFinishedBuffer(5000);
    //
    // Process the image view constructed from an acquisition buffer
    using var image = pipeline.Process(buffer.ToImageView());
  • Python
    # Initialize pipeline with default settings
    pipeline = DefaultPipeline()
    # Get a buffer from IDS peak genericAPI
    buffer = data_stream.WaitForFinishedBuffer(ids_peak.Timeout(5000))
    # Process the image view constructed from an acquisition buffer
    image = pipeline.process(buffer.ToImageView())

Usage with Settings from a JSON File

The pipeline can be configured using a JSON settings file. This allows you to load settings saved with peak Cockpit, enabling you to customize the pipeline’s behavior without modifying the source code.

To apply the configuration, load the settings by calling the import settings from file method with the JSON file before processing images.

  • C++
    pipeline.ImportSettingsFromFile("pipeline_settings.json");
  • C#
    pipeline.ImportSettingsFromFile("pipeline_settings.json");
  • Python
    pipeline.import_settings_from_file("pipeline_settings.json")

It is also possible to save the pipeline configuration programmatically, making it easy to reuse or share settings.

  • C++
    pipeline.ExportSettingsToFile("my_pipeline_settings.json");
  • C#
    pipeline.ExportSettingsToFile("my_pipeline_settings.json");
  • Python
    pipeline.export_settings_to_file("my_pipeline_settings.json")

Fine-Tune Individual Stages

You can fine-tune specific stages of the pipeline by accessing their settings directly. For example, you can adjust parameters like gain, gamma and binning as shown below:

  • C++
    pipeline.Gain().SetMaster(1.2f);
    pipeline.Gamma().SetValue(2.2f);
    pipeline.Binning().SetX(2);
    pipeline.Binning().SetY(2);
  • C#
    pipeline.Gain.Master = 1.2f;
    pipeline.Gamma.Value = 2.2f;
    pipeline.Binning.X = 2;
    pipeline.Binning.Y = 2;
  • Python
    pipeline.gain.master = 1.2
    pipeline.gamma.value = 2.2
    pipeline.binning.x = 2
    pipeline.binning.y = 2

Reset all Features to their Defaults

You can reset all pipeline settings to their default values with a single method call. This is useful if you want to undo all customizations and return to the default configuration.

  • C++
    pipeline.ResetToDefault();
  • C#
    pipeline.ResetToDefault();
  • Python
    pipeline.reset_to_default()

Enable or Disable Specific Features

You can enable or disable individual features in the pipeline. This allows you to customize which parts of the pipeline are active during processing.

  • C++
    pipeline.Sharpening().SetEnabled(true);
    pipeline.ColorCorrection().SetEnabled(false);
  • C#
    pipeline.Sharpening.IsEnabled = true;
    pipeline.ColorCorrection.IsEnabled = false;
  • Python
    pipeline.sharpening.enabled = True
    pipeline.color_correction.enabled = False

Output Format Considerations

Use the following method to define the pipeline’s output pixel format. The pipeline will automatically convert processed images to the selected format during execution. By default, the output pixel format is RGB8 (see PixelFormatConversionModule).

Based on this setting, the pipeline:

  • Automatically enables required modules such as debayering, mono conversion, or format conversion.
  • Automatically skips modules that are incompatible with the target format.

For example, when the output format is a Bayer type, the following modules are bypassed:

  • Debayer
  • Gamma
  • Sharpening
  • Color Correction

Processing Policy Considerations

The pipeline provides fine-tuned control over bit depth handling through a configurable processing policy. You can set the desired policy:

  • Fast Reduces bit depth as early as possible (e.g., from 12-bit to 8-bit) to maximize throughput. Ideal for preview streams or latency-critical applications.
  • Balanced (default) Maintains the input bit depth throughout processing and reduces bit depth only at the final stage. Balances processing speed with image quality.
  • Enhanced Expands to a higher bit depth (e.g., from 8-bit to 10-bit float) for all internal processing if the target bit depth is higher than the source. Improves image quality for downstream stages such as color correction, gamma, and sharpening, at the cost of increased processing time.

Initializing and Configuring Auto Features (optional)

To enable automatic adjustments like auto brightness, auto white balance, or auto focus, you need to create and configure an auto features module and then pass it to the pipeline. This requires that the IDS peak AFL library is properly installed and linked in your project. The following example demonstrates how to create, configure, and attach the auto features module to the pipeline.

Prerequisite: A device must already be opened using IDS peak genericAPI, and its reference stored in the variable device.

  • C++
    // Create an auto features module linked to the device
    auto autoFeatures = std::make_shared<peak::pipeline::modules::BasicAutoFeatures>(device);
    //
    // Configure all auto controllers to run in continuous mode
    autoFeatures->SetAllModes(peak::pipeline::modules::autofeature::ControllerMode::Continuous);
    //
    // Access the auto brightness controller to customize its settings
    auto& brightness = autoFeatures->AutoBrightness();
    brightness.SetAutoTarget(200);
    brightness.SetRoi(peak::common::Rectangle{ 1'600, 400, 200, 200 });
    //
    // Attach the configured auto features module to the pipeline
    pipeline.SetAutoFeatureModule(autoFeatures);
  • C#
    // Create an auto features module linked to the device
    using var autoFeatures = new BasicAutoFeatures(device);
    //
    // Configure all auto controllers to run in continuous mode
    autoFeatures.SetAllModes(ControllerMode.Continuous);
    //
    // Access the auto brightness controller to customize its settings
    autoFeatures.AutoBrightness.AutoTarget = 200;
    autoFeatures.AutoBrightness.Roi = new Rectangle(1600, 400, 200, 200);
    //
    // Attach the configured auto features module to the pipeline
    pipeline.AutoFeatureModule = autoFeatures;
  • Python
    # Create an auto features module linked to the device
    auto_features = BasicAutoFeatures(device)
    # Configure all auto controllers to run in continuous mode
    auto_features.set_all_modes(ControllerMode.CONTINUOUS)
    # Access the auto brightness controller to customize its settings
    brightness = auto_features.auto_brightness
    brightness.auto_target = 200
    brightness.roi = Rectangle(Point(1600, 400), Size(200, 200))
    # Attach the configured auto features module to the pipeline
    pipeline.autofeature_module = auto_features