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

Public Member Functions

None __init__ (self)
 Creates an instance of class ModuleBase.
 
None __del__ (self)
 
str type (self)
 Returns the type of the module (used for serialization or UI).
 
None reset_to_default (self)
 Resets the output pixel format to its default value (RGB8).
 
PixelFormat output_pixel_format (self)
 Returns the currently set output pixel format.
 
None output_pixel_format (self, PixelFormat output_pixel_format)
 Sets the desired output pixel format.
 
Image process (self, Image input_image)
 Processes the input image, performing mono conversion if enabled.
 
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.
 

Data Fields

PixelFormat _enabled = self._output_pixel_format:
 

Static Public Attributes

PixelFormat DEFAULT_OUTPUT_PIXEL_FORMAT = PixelFormat.RGB_8
 

Protected Attributes

 _handle = image_converter_handle
 
PixelFormat _output_pixel_format = self.DEFAULT_OUTPUT_PIXEL_FORMAT
 
bool _enabled = True
 

Detailed Description

Pixel format conversion module that transforms images to a specified output pixel format.

This module allows explicit control over the output pixel format and provides serialization capabilities for saving/restoring state.

Default pixel format: PixelFormat.RGB8

Since
ids_peak_icv 1.0

Definition at line 13 of file pixelformat_conversion_module.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self)

Creates an instance of class ModuleBase.

Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 28 of file pixelformat_conversion_module.py.

◆ __del__()

None __del__ ( self)

Definition at line 44 of file pixelformat_conversion_module.py.

Member Function Documentation

◆ 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 159 of file pixelformat_conversion_module.py.

◆ output_pixel_format() [1/2]

PixelFormat output_pixel_format ( self)

Returns the currently set output pixel format.

Returns
Output pixel format.
Since
ids_peak_icv 1.0

Definition at line 70 of file pixelformat_conversion_module.py.

◆ output_pixel_format() [2/2]

None output_pixel_format ( self,
PixelFormat output_pixel_format )

Sets the desired output pixel format.

Parameters
output_pixel_formatPixelFormat to be set as output.
Since
ids_peak_icv 1.0

Definition at line 82 of file pixelformat_conversion_module.py.

◆ process()

Image process ( self,
Image input_image )

Processes the input image, performing mono conversion if enabled.

This function converts the input image to a monochrome format if the module is enabled. The output image preserves the bit depth of the input. If the module is disabled, the input image is returned unchanged.

Parameters
input_imageThe input image to convert.
Returns
The processed image in mono format if enabled; otherwise, the original image.
Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 93 of file pixelformat_conversion_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 122 of file pixelformat_conversion_module.py.

◆ reset_to_default()

None reset_to_default ( self)

Resets the output pixel format to its default value (RGB8).

Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 60 of file pixelformat_conversion_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 143 of file pixelformat_conversion_module.py.

◆ type()

str type ( self)

Returns the type of the module (used for serialization or UI).

Returns
Module type.
Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 49 of file pixelformat_conversion_module.py.

Field Documentation

◆ _enabled [1/2]

bool _enabled = True
protected

Definition at line 42 of file pixelformat_conversion_module.py.

◆ _enabled [2/2]

PixelFormat _enabled = self._output_pixel_format:

Definition at line 107 of file pixelformat_conversion_module.py.

◆ _handle

_handle = image_converter_handle
protected

Definition at line 40 of file pixelformat_conversion_module.py.

◆ _output_pixel_format

PixelFormat _output_pixel_format = self.DEFAULT_OUTPUT_PIXEL_FORMAT
protected

Definition at line 41 of file pixelformat_conversion_module.py.

◆ DEFAULT_OUTPUT_PIXEL_FORMAT

PixelFormat DEFAULT_OUTPUT_PIXEL_FORMAT = PixelFormat.RGB_8
static

Definition at line 26 of file pixelformat_conversion_module.py.