IDS peak ICV v1.2.0
Loading...
Searching...
No Matches
UnpackModule Class Reference
Inheritance diagram for UnpackModule:

Public Member Functions

None __init__ (self)
 Creates an instance of class UnpackModule.
 
None __del__ (self)
 
int target_bit_depth (self)
 Get the target bit depth used during image processing.
 
None target_bit_depth (self, int bit_depth)
 Set the target bit depth for image processing.
 
ProcessingPolicy processing_policy (self)
 Get the currently configured processing policy.
 
None processing_policy (self, ProcessingPolicy policy)
 Set the processing policy.
 
bool enabled (self)
 Returns true since the unpack module is always enabled.
 
None enabled (self, bool enabled)
 Does nothing.
 
str type (self)
 Returns the type of the module for serialization purposes.
 
Image process (self, Image input_image)
 Converts a packed pixel format image into an unpacked Bayer or monochrome format.
 
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

 DEFAULT_POLICY = ProcessingPolicy.FAST
 
int DEFAULT_TARGET_BIT_DEPTH = 8
 

Protected Member Functions

int _get_output_bit_depth (self, int input_bit_depth)
 
PixelFormat _get_output_pixel_format (self, PixelFormat input_pixel_format, int output_bit_depth)
 

Static Protected Member Functions

PixelFormat _bayer_bg_format (int bit_depth)
 
PixelFormat _bayer_gb_format (int bit_depth)
 
PixelFormat _bayer_gr_format (int bit_depth)
 
PixelFormat _bayer_rg_format (int bit_depth)
 
PixelFormat _mono_format (int bit_depth)
 

Protected Attributes

 _handle = image_converter_handle
 
int _target_bit_depth = self.DEFAULT_TARGET_BIT_DEPTH
 
ProcessingPolicy _policy = self.DEFAULT_POLICY
 

Detailed Description

Unpack is an image pipeline module that converts packed pixel formats into corresponding unpacked Bayer or mono formats.

The unpack module is always enabled and cannot be disabled. It converts input images with packed pixel formats into their corresponding unpacked Bayer or monochrome formats, preserving the original bit depth of the image.

Default configuration:

Since
ids_peak_icv 1.0

Definition at line 13 of file unpack_module.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self)

Creates an instance of class UnpackModule.

Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 33 of file unpack_module.py.

◆ __del__()

None __del__ ( self)

Definition at line 49 of file unpack_module.py.

Member Function Documentation

◆ _bayer_bg_format()

PixelFormat _bayer_bg_format ( int bit_depth)
staticprotected

Definition at line 317 of file unpack_module.py.

◆ _bayer_gb_format()

PixelFormat _bayer_gb_format ( int bit_depth)
staticprotected

Definition at line 325 of file unpack_module.py.

◆ _bayer_gr_format()

PixelFormat _bayer_gr_format ( int bit_depth)
staticprotected

Definition at line 333 of file unpack_module.py.

◆ _bayer_rg_format()

PixelFormat _bayer_rg_format ( int bit_depth)
staticprotected

Definition at line 341 of file unpack_module.py.

◆ _get_output_bit_depth()

int _get_output_bit_depth ( self,
int input_bit_depth )
protected

Definition at line 246 of file unpack_module.py.

◆ _get_output_pixel_format()

PixelFormat _get_output_pixel_format ( self,
PixelFormat input_pixel_format,
int output_bit_depth )
protected

Definition at line 253 of file unpack_module.py.

◆ _mono_format()

PixelFormat _mono_format ( int bit_depth)
staticprotected

Definition at line 349 of file unpack_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.
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 227 of file unpack_module.py.

◆ enabled() [1/2]

bool enabled ( self)

Returns true since the unpack module is always enabled.

Returns
True
Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 118 of file unpack_module.py.

◆ enabled() [2/2]

None enabled ( self,
bool enabled )

Does nothing.

The module is always enabled, because otherwise following modules will fail.

Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 129 of file unpack_module.py.

◆ process()

Image process ( self,
Image input_image )

Converts a packed pixel format image into an unpacked Bayer or monochrome format.

This function unpacks the input image from a packed format to its corresponding unpacked Bayer or monochrome format, preserving the input bit depth.

This operation disregards any specified image regions and processes the entire image.

Parameters
input_imageinput The packed input image to unpack.
Returns
The unpacked output image with the downsampled bit depth.
Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 149 of file unpack_module.py.

◆ processing_policy() [1/2]

ProcessingPolicy processing_policy ( self)

Get the currently configured processing policy.

Returns
The active processing policy.
Since
ids_peak_icv 1.0

Definition at line 96 of file unpack_module.py.

◆ processing_policy() [2/2]

None processing_policy ( self,
ProcessingPolicy policy )

Set the processing policy.

Parameters
policyThe desired processing policy.
Since
ids_peak_icv 1.0

Definition at line 107 of file unpack_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 192 of file unpack_module.py.

◆ reset_to_default()

None reset_to_default ( self)

Resets all module settings.

Resets the target bit depth to 8 and the processing policy to ProcessingPolicy.FAST

Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 180 of file unpack_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 211 of file unpack_module.py.

◆ target_bit_depth() [1/2]

int target_bit_depth ( self)

Get the target bit depth used during image processing.

This value specifies the bit depth the module will aim for when unpacking packed pixel formats. The actual output bit depth depends on the selected :class:ProcessingPolicy.

Returns
The currently configured target bit depth.
Since
ids_peak_icv 1.0

Definition at line 54 of file unpack_module.py.

◆ target_bit_depth() [2/2]

None target_bit_depth ( self,
int bit_depth )

Set the target bit depth for image processing.

The target bit depth acts as a reference when deciding how to unpack packed pixel formats. The actual resulting bit depth depends on the selected :class:ProcessingPolicy:

  • Fast: The output bit depth is the minimum of the input image bit depth and the target bit depth.
  • Balanced: The output bit depth is the same as the input image bit depth (the target value is ignored).
  • Enhanced: The output bit depth is the maximum of the input image bit depth and the target bit depth.

This allows you to downsample, preserve, or enhance bit depth depending on your use case.

Parameters
bit_depthThe desired target bit depth (e.g., 8, 10, 12).
Since
ids_peak_icv 1.0

Definition at line 70 of file unpack_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 139 of file unpack_module.py.

Field Documentation

◆ _handle

_handle = image_converter_handle
protected

Definition at line 45 of file unpack_module.py.

◆ _policy

ProcessingPolicy _policy = self.DEFAULT_POLICY
protected

Definition at line 47 of file unpack_module.py.

◆ _target_bit_depth

_target_bit_depth = self.DEFAULT_TARGET_BIT_DEPTH
protected

Definition at line 46 of file unpack_module.py.

◆ DEFAULT_POLICY

DEFAULT_POLICY = ProcessingPolicy.FAST
static

Definition at line 30 of file unpack_module.py.

◆ DEFAULT_TARGET_BIT_DEPTH

int DEFAULT_TARGET_BIT_DEPTH = 8
static

Definition at line 31 of file unpack_module.py.