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

Public Member Functions

None __init__ (self)
 Creates an instance of the debayer module.
 
None __del__ (self)
 
str type (self)
 Returns the type of the module for serialization purposes.
 
DebayerChannelLayout channel_layout (self)
 Get the output channel layout used for debayered images.
 
None channel_layout (self, DebayerChannelLayout layout)
 Set the output channel layout for debayered images.
 
DebayerConversionPolicy conversion_policy (self)
 Get the current conversion policy.
 
None conversion_policy (self, DebayerConversionPolicy policy)
 Set the debayer conversion policy.
 
int target_bit_depth (self)
 Get the target bit depth for processed images.
 
None target_bit_depth (self, int bit_depth)
 Set the target bit depth for processed images.
 
ProcessingPolicy processing_policy (self)
 Get the processing policy.
 
None processing_policy (self, ProcessingPolicy policy)
 Set the processing policy.
 
Image process (self, Image input_image)
 Converts a Bayer or mono image to a color image, or returns the input image unchanged.
 
None reset_to_default (self)
 Resets all settings to their defaults.
 
None release_buffers (self)
 Frees unused internal buffers.
 
None serialize (self, IArchive archive)
 Serializes the object's internal state into the provided archive.
 
None deserialize (self, IArchive archive)
 Restores the object's state from the provided archive.
 

Static Public Attributes

DebayerChannelLayout DEFAULT_CHANNEL_LAYOUT = DebayerChannelLayout.RGB
 
DebayerConversionPolicy DEFAULT_CONVERSION_POLICY = DebayerConversionPolicy.BAYER_ONLY
 
int DEFAULT_TARGET_BIT_DEPTH = 8
 
ProcessingPolicy DEFAULT_POLICY = ProcessingPolicy.FAST
 

Protected Member Functions

int _get_output_bit_depth (self, int input_bit_depth)
 
PixelFormat _get_output_format (self, PixelFormat input_pixel_format)
 

Protected Attributes

 _handle = image_converter_handle
 
DebayerChannelLayout _channel_layout = self.DEFAULT_CHANNEL_LAYOUT
 
DebayerConversionPolicy _conversion_policy = self.DEFAULT_CONVERSION_POLICY
 
int _target_bit_depth = self.DEFAULT_TARGET_BIT_DEPTH
 
ProcessingPolicy _policy = self.DEFAULT_POLICY
 
 _enabled
 

Detailed Description

Debayer is an image pipeline module that converts Bayer RAW images into standard color formats.

It performs demosaicing on Bayer-pattern RAW images, converting them into full-color images using configurable channel layouts such as RGB, BGR, RGBA, or BGRA. The bit depth of the output is inferred from the input, depending on the selected processing policy.

Default configuration:

  • Channel layout: DebayerChannelLayout.RGB
  • Conversion policy: DebayerConversionPolicy.BAYER_ONLY
  • Target bit depth: 8
  • Processing policy: ProcessingPolicy.FAST
Since
ids_peak_icv 1.0

Definition at line 16 of file debayer_module.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self)

Creates an instance of the debayer module.

Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 40 of file debayer_module.py.

◆ __del__()

None __del__ ( self)

Definition at line 60 of file debayer_module.py.

Member Function Documentation

◆ _get_output_bit_depth()

int _get_output_bit_depth ( self,
int input_bit_depth )
protected

Definition at line 305 of file debayer_module.py.

◆ _get_output_format()

PixelFormat _get_output_format ( self,
PixelFormat input_pixel_format )
protected

Definition at line 312 of file debayer_module.py.

◆ channel_layout() [1/2]

DebayerChannelLayout channel_layout ( self)

Get the output channel layout used for debayered images.

Returns
The currently configured DebayerChannelLayout.
Since
ids_peak_icv 1.0

Definition at line 77 of file debayer_module.py.

◆ channel_layout() [2/2]

None channel_layout ( self,
DebayerChannelLayout layout )

Set the output channel layout for debayered images.

This controls the order and number of color channels in the converted image.

Parameters
layoutDesired channel layout
Since
ids_peak_icv 1.0

Definition at line 89 of file debayer_module.py.

◆ conversion_policy() [1/2]

DebayerConversionPolicy conversion_policy ( self)

Get the current conversion policy.

Returns
The currently configured DebayerConversionPolicy.
Since
ids_peak_icv 1.0

Definition at line 102 of file debayer_module.py.

◆ conversion_policy() [2/2]

None conversion_policy ( self,
DebayerConversionPolicy policy )

Set the debayer conversion policy.

This policy determines which types of input images will be converted. All other image types are passed through unchanged.

Parameters
policyThe desired conversion policy.
Since
ids_peak_icv 1.0

Definition at line 114 of file debayer_module.py.

◆ deserialize()

None deserialize ( self,
IArchive archive )

Restores the object's state from the provided archive.

This function reads and applies all necessary parameters from the given archive to reconstruct the internal state of the object. It ensures that the object is restored to a valid and consistent state.

Parameters
archiveThe source archive containing the serialized parameters.
Exceptions
CorruptedExceptionIf Archive is malformed, misses keys or the values are invalid
NotSupportedExceptionIf the 'Version' entry indicates an unsupported version.
Note
This function requires that the archive contains all expected fields as produced by a corresponding serialize() call.
Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 280 of file debayer_module.py.

◆ process()

Image process ( self,
Image input_image )

Converts a Bayer or mono image to a color image, or returns the input image unchanged.

A demosaicing algorithm is applied according to the configured conversion policy. The input image is returned unchanged if the module is disabled, the policy indicates bypass, or the image format is not eligible for conversion. Otherwise, the Bayer RAW image is converted to the configured output format.

Note
This operation disregards any specified image regions and processes the entire image.
Parameters
input_imageThe input image (Bayer, mono, or already color).
Returns
The processed color image or the unmodified input image.
Since
ids_peak_icv 1.0

Definition at line 181 of file debayer_module.py.

◆ processing_policy() [1/2]

ProcessingPolicy processing_policy ( self)

Get the processing policy.

Returns
Current ProcessingPolicy value.
Since
ids_peak_icv 1.0

Definition at line 157 of file debayer_module.py.

◆ processing_policy() [2/2]

None processing_policy ( self,
ProcessingPolicy policy )

Set the processing policy.

The processing policy defines how the target bit depth interacts with the input image bit depth.

Parameters
policyThe desired ProcessingPolicy.
Since
ids_peak_icv 1.0

Definition at line 167 of file debayer_module.py.

◆ release_buffers()

None release_buffers ( self)

Frees unused internal buffers.

This module uses 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.

Note
Avoid calling this function too frequently (e.g., after every resize or format change), as it introduces some overhead.
Since
ids_peak_icv 1.0

Definition at line 241 of file debayer_module.py.

◆ reset_to_default()

None reset_to_default ( self)

Resets all settings to their defaults.

Default configuration:

  • channel_layout = RGB
  • conversion_policy = BAYER_ONLY
  • target_bit_depth = 8
  • processing_policy = FAST
Note
The enabled state does not change when calling this function.
Since
ids_peak_icv 1.0

Definition at line 221 of file debayer_module.py.

◆ serialize()

None serialize ( self,
IArchive archive )

Serializes the object's internal state into the provided archive.

This function populates the given archive with all parameters required to fully represent the current state of the object. It ensures that the object can be reconstructed or transmitted accurately by saving all relevant data members in a consistent and structured format.

Parameters
archiveThe target archive that will store the serialized parameters.
Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 263 of file debayer_module.py.

◆ target_bit_depth() [1/2]

int target_bit_depth ( self)

Get the target bit depth for processed images.

Returns
Target bit depth as an integer.
Since
ids_peak_icv 1.0

Definition at line 129 of file debayer_module.py.

◆ target_bit_depth() [2/2]

None target_bit_depth ( self,
int bit_depth )

Set the target bit depth for processed images.

The effective output bit depth depends on the selected :class:ProcessingPolicy:

  • FAST: The minimum of input bit depth and target bit depth.
  • BALANCED: Equal to input bit depth.
  • ENHANCED: The maximum of input bit depth and target bit depth.
Parameters
bit_depthThe desired target bit depth (e.g., 8, 10, 12).
Since
ids_peak_icv 1.0

Definition at line 139 of file debayer_module.py.

◆ type()

str type ( self)

Returns the type of the module for serialization purposes.

Returns
Module type
Since
ids_peak_icv 1.0

Definition at line 65 of file debayer_module.py.

Field Documentation

◆ _channel_layout

DebayerChannelLayout _channel_layout = self.DEFAULT_CHANNEL_LAYOUT
protected

Definition at line 55 of file debayer_module.py.

◆ _conversion_policy

_conversion_policy = self.DEFAULT_CONVERSION_POLICY
protected

Definition at line 56 of file debayer_module.py.

◆ _enabled

_enabled
protected

Definition at line 202 of file debayer_module.py.

◆ _handle

_handle = image_converter_handle
protected

Definition at line 54 of file debayer_module.py.

◆ _policy

ProcessingPolicy _policy = self.DEFAULT_POLICY
protected

Definition at line 58 of file debayer_module.py.

◆ _target_bit_depth

_target_bit_depth = self.DEFAULT_TARGET_BIT_DEPTH
protected

Definition at line 57 of file debayer_module.py.

◆ DEFAULT_CHANNEL_LAYOUT

DebayerChannelLayout DEFAULT_CHANNEL_LAYOUT = DebayerChannelLayout.RGB
static

Definition at line 35 of file debayer_module.py.

◆ DEFAULT_CONVERSION_POLICY

DebayerConversionPolicy DEFAULT_CONVERSION_POLICY = DebayerConversionPolicy.BAYER_ONLY
static

Definition at line 36 of file debayer_module.py.

◆ DEFAULT_POLICY

ProcessingPolicy DEFAULT_POLICY = ProcessingPolicy.FAST
static

Definition at line 38 of file debayer_module.py.

◆ DEFAULT_TARGET_BIT_DEPTH

int DEFAULT_TARGET_BIT_DEPTH = 8
static

Definition at line 37 of file debayer_module.py.