IDS peak ICV v1.2.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 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)
 Processes the input image by applying debayering (if enabled).
 
None reset_to_default (self)
 Resets all module settings.
 
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:

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 41 of file debayer_module.py.

◆ __del__()

None __del__ ( self)

Definition at line 61 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 290 of file debayer_module.py.

◆ _get_output_format()

PixelFormat _get_output_format ( self,
PixelFormat input_pixel_format )
protected

Definition at line 297 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 76 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. The bit depth is automatically inherited from the input Bayer image.

Parameters
layoutDesired channel layout
Since
ids_peak_icv 1.0

Definition at line 87 of file debayer_module.py.

◆ conversion_policy() [1/2]

DebayerConversionPolicy conversion_policy ( self)

Get the conversion policy.

Returns
The currently configured DebayerConversionPolicy.
Since
ids_peak_icv 1.0

Definition at line 101 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
policyDesired conversion policy.
Since
ids_peak_icv 1.0

Definition at line 111 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 265 of file debayer_module.py.

◆ process()

Image process ( self,
Image input_image )

Processes the input image by applying debayering (if enabled).

  • If the module is disabled, returns the input image unchanged.
  • If the conversion policy indicates bypass or the image format is not eligible, returns the input image unchanged.
  • Otherwise, converts the Bayer RAW image to the configured output format.
Parameters
input_imageInput image to be processed.
Returns
Processed output image.
Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 175 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 152 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
policyDesired ProcessingPolicy.
Since
ids_peak_icv 1.0

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

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 226 of file debayer_module.py.

◆ reset_to_default()

None reset_to_default ( self)

Resets all module settings.

Restores the module configuration to its default values:

  • Channel layout = RGB
  • Conversion policy = BAYER_ONLY
  • Target bit depth = 8
  • Processing policy = FAST
Since
ids_peak_icv 1.0

Reimplemented from IModule.

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

Returns
The serialized module's internal state.
Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 248 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 125 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_depthDesired target bit depth (e.g., 8, 10, 12).
Since
ids_peak_icv 1.0

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

Reimplemented from IModule.

Definition at line 66 of file debayer_module.py.

Field Documentation

◆ _channel_layout

DebayerChannelLayout _channel_layout = self.DEFAULT_CHANNEL_LAYOUT
protected

Definition at line 56 of file debayer_module.py.

◆ _conversion_policy

_conversion_policy = self.DEFAULT_CONVERSION_POLICY
protected

Definition at line 57 of file debayer_module.py.

◆ _enabled

_enabled
protected

Definition at line 189 of file debayer_module.py.

◆ _handle

_handle = image_converter_handle
protected

Definition at line 55 of file debayer_module.py.

◆ _policy

ProcessingPolicy _policy = self.DEFAULT_POLICY
protected

Definition at line 59 of file debayer_module.py.

◆ _target_bit_depth

_target_bit_depth = self.DEFAULT_TARGET_BIT_DEPTH
protected

Definition at line 58 of file debayer_module.py.

◆ DEFAULT_CHANNEL_LAYOUT

DebayerChannelLayout DEFAULT_CHANNEL_LAYOUT = DebayerChannelLayout.RGB
static

Definition at line 36 of file debayer_module.py.

◆ DEFAULT_CONVERSION_POLICY

DebayerConversionPolicy DEFAULT_CONVERSION_POLICY = DebayerConversionPolicy.BAYER_ONLY
static

Definition at line 37 of file debayer_module.py.

◆ DEFAULT_POLICY

ProcessingPolicy DEFAULT_POLICY = ProcessingPolicy.FAST
static

Definition at line 39 of file debayer_module.py.

◆ DEFAULT_TARGET_BIT_DEPTH

int DEFAULT_TARGET_BIT_DEPTH = 8
static

Definition at line 38 of file debayer_module.py.