IDS peak ICV v1.6.0
Loading...
Searching...
No Matches
DownsamplingModule Class Reference

#include <peak_icv/pipeline/detail/peak_icv_downsampling_module.hpp>

Inheritance diagram for DownsamplingModule:

Public Member Functions

 DownsamplingModule ()
 Creates a DownsamplingModule with default values.
 
 DownsamplingModule (DownsamplingMode defaultMode, std::string customName)
 Creates a DownsamplingModule with factors x = 1, y = 1 and the given downsampling mode and name.
 
 ~DownsamplingModule () override
 
 DownsamplingModule (const DownsamplingModule &other)=delete
 Copy constructor for class DownsamplingModule is deleted.
 
 DownsamplingModule (DownsamplingModule &&other) noexcept
 
DownsamplingModule & operator= (const DownsamplingModule &other)=delete
 Copy assignment for class DownsamplingModule is deleted.
 
DownsamplingModule & operator= (DownsamplingModule &&other) noexcept
 
void SetEnabled (bool enabled) override
 Enables or disables the module.
 
bool IsEnabled () const override
 Gets whether this module is currently enabled.
 
void Serialize (peak::common::serialization::IArchive &archive) const override
 Serializes the object's internal state into the provided archive.
 
void Deserialize (const peak::common::serialization::IArchive &archive) override
 Restores the object's state from the provided archive.
 
peak::icv::Image Process (const peak::icv::Image &input) const
 Applies the downsampling factors and mode to the input image and returns a downsampled copy based on current settings.
 
peak::common::Any Process (const peak::common::Any &input) const override
 Applies the downsampling factors and mode to the input image and returns a downsampled copy based on current settings.
 
const char * GetType () const override
 Returns the type of the module for serialization purposes or the custom type, if defined.
 
void SetCustomType (const std::string &type)
 Sets the custom type of the module for serialization purposes.
 
void ResetToDefault () override
 Resets all settings to their default values defined at initialization, i.e. x = 1, y = 1, and the initial downsampling mode.
 
void SetX (uint32_t x)
 Sets the number of columns to downsample.
 
void SetY (uint32_t y)
 Sets the number of rows to downsample.
 
uint32_t GetX () const
 Returns the current number of columns used for downsampling.
 
uint32_t GetY () const
 Returns the current number of rows used for downsampling.
 
peak::common::IntervalU GetRange () const
 Returns the valid range for downsampling factors x and y.
 
void SetMode (const DownsamplingMode &mode)
 Sets the DownsamplingMode.
 
DownsamplingMode GetMode () const
 Returns the current DownsamplingMode.
 

Detailed Description

Downsampling is used to decrease the image size.

This module provides comprehensive functionality for image downsampling, which is the process of reducing image resolution and dimensions. It supports multiple algorithms optimized for various use cases.

There are two basic techniques for downsampling:

  • Binning This method reduces resolution by summarizing or averaging groups of pixels in the horizontal (x) and/or vertical (y) directions. It helps preserve image quality by minimizing aliasing artifacts.
  • Decimation This method reduces resolution by selecting (i.e., skipping) pixels at regular intervals along columns (x), rows (y) or both. It is computationally efficient but may introduce aliasing.

The reduction factors are specified separately for the x (columns) and y (rows) directions.

Since
ids_peak_icv 1.0

Constructor & Destructor Documentation

◆ DownsamplingModule() [1/4]

DownsamplingModule ( )
inlineexplicit

◆ DownsamplingModule() [2/4]

DownsamplingModule ( DownsamplingMode defaultMode,
std::string customName )
inlineexplicit

Creates a DownsamplingModule with factors x = 1, y = 1 and the given downsampling mode and name.

Since
ids_peak_icv 1.0

◆ ~DownsamplingModule()

~DownsamplingModule ( )
inlineoverride
Since
ids_peak_icv 1.0

◆ DownsamplingModule() [3/4]

DownsamplingModule ( const DownsamplingModule & other)
delete

Copy constructor for class DownsamplingModule is deleted.

Note
If you need to copy a module, you can create a new one and copy the parameters via Serialize() and Deserialize().
Since
ids_peak_icv 1.0

◆ DownsamplingModule() [4/4]

DownsamplingModule ( DownsamplingModule && other)
inlinenoexcept
Since
ids_peak_icv 1.0

Member Function Documentation

◆ Deserialize()

void Deserialize ( const peak::common::serialization::IArchive & archive)
inlineoverridevirtual

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 the 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

Implements ISerializable.

◆ GetMode()

DownsamplingMode GetMode ( ) const
inline

Returns the current DownsamplingMode.

Returns
The current DownsamplingMode.
Since
ids_peak_icv 1.0

◆ GetRange()

peak::common::IntervalU GetRange ( ) const
inline

Returns the valid range for downsampling factors x and y.

Returns
The valid range.
Since
ids_peak_icv 1.0

◆ GetType()

const char * GetType ( ) const
inlineoverridevirtual

Returns the type of the module for serialization purposes or the custom type, if defined.

Returns
A string representing the module's type.
Since
ids_peak_icv 1.0

Implements IModule.

◆ GetX()

uint32_t GetX ( ) const
inline

Returns the current number of columns used for downsampling.

Returns
The current number of columns to downsample.
Since
ids_peak_icv 1.0

◆ GetY()

uint32_t GetY ( ) const
inline

Returns the current number of rows used for downsampling.

Returns
The current number of rows to downsample.
Since
ids_peak_icv 1.0

◆ IsEnabled()

bool IsEnabled ( ) const
inlineoverridevirtual

Gets whether this module is currently enabled.

Returns
true if enabled; otherwise false.
Since
ids_peak_icv 1.0

Implements IModule.

◆ operator=() [1/2]

DownsamplingModule & operator= ( const DownsamplingModule & other)
delete

Copy assignment for class DownsamplingModule is deleted.

Note
If you need to copy a module, you can create a new one and copy the parameters via Serialize() and Deserialize().
Since
ids_peak_icv 1.0

◆ operator=() [2/2]

DownsamplingModule & operator= ( DownsamplingModule && other)
inlinenoexcept
Since
ids_peak_icv 1.0

◆ Process() [1/2]

peak::common::Any Process ( const peak::common::Any & input) const
inlineoverridevirtual

Applies the downsampling factors and mode to the input image and returns a downsampled copy based on current settings.

Supported pixel formats
  • BayerGR8
  • BayerGR10
  • BayerGR12
  • BayerRG8
  • BayerRG10
  • BayerRG12
  • BayerGB8
  • BayerGB10
  • BayerGB12
  • BayerBG8
  • BayerBG10
  • BayerBG12
  • Mono8
  • Mono10
  • Mono12
  • Mono16
  • Confidence8
  • Confidence16
  • Coord3D_C8
  • Coord3D_C16
  • Coord3D_C32f
  • Coord3D_ABC32f
  • RGB8
  • RGB10
  • RGB12
  • BGR8
  • BGR10
  • BGR12
  • RGBa8
  • RGBa10
  • RGBa12
  • BGRa8
  • BGRa10
  • BGRa12
  • Mono32fIDS
  • RGB32fIDS
  • Mono32f
  • RGB32f

See the Pixel and Pixel Format Specifications for a detailed description of the pixel formats.

Note
Processes the entire image, ignoring any specified image region. The alpha channel of the input image (if present) is also ignored. This is because the alpha channel can have different interpretations — such as transparency, segmentation labels, or masks — each of which would require different handling during binning. Consequently, the alpha channel of the output image is always set to the maximum possible pixel value.
Parameters
inputThe input image to be processed.
Returns
A new image object that is the transformed result of the input.
Exceptions
peak::common::InvalidCastExceptionIf the input cast to peak::icv::Image failed.
NotSupportedExceptionIf image has any other than the supported pixel formats.
Since
ids_peak_icv 1.0

Implements IModule.

◆ Process() [2/2]

peak::icv::Image Process ( const peak::icv::Image & input) const
inline

Applies the downsampling factors and mode to the input image and returns a downsampled copy based on current settings.

Supported pixel formats
  • BayerGR8
  • BayerGR10
  • BayerGR12
  • BayerRG8
  • BayerRG10
  • BayerRG12
  • BayerGB8
  • BayerGB10
  • BayerGB12
  • BayerBG8
  • BayerBG10
  • BayerBG12
  • Mono8
  • Mono10
  • Mono12
  • Mono16
  • Confidence8
  • Confidence16
  • Coord3D_C8
  • Coord3D_C16
  • Coord3D_C32f
  • Coord3D_ABC32f
  • RGB8
  • RGB10
  • RGB12
  • BGR8
  • BGR10
  • BGR12
  • RGBa8
  • RGBa10
  • RGBa12
  • BGRa8
  • BGRa10
  • BGRa12
  • Mono32fIDS
  • RGB32fIDS
  • Mono32f
  • RGB32f

See the Pixel and Pixel Format Specifications for a detailed description of the pixel formats.

Note
Processes the entire image, ignoring any specified image region. The alpha channel of the input image (if present) is also ignored. This is because the alpha channel can have different interpretations — such as transparency, segmentation labels, or masks — each of which would require different handling during binning. Consequently, the alpha channel of the output image is always set to the maximum possible pixel value.
Parameters
inputThe input image to be processed.
Returns
A new image object that is the transformed result of the input.
Exceptions
NotSupportedExceptionIf image has any other than the supported pixel formats.
Since
ids_peak_icv 1.0

◆ ResetToDefault()

void ResetToDefault ( )
inlineoverridevirtual

Resets all settings to their default values defined at initialization, i.e. x = 1, y = 1, and the initial downsampling mode.

Note
The enabled state and CustomType do not change when calling this function.
Since
ids_peak_icv 1.0

Implements IModule.

◆ Serialize()

void Serialize ( peak::common::serialization::IArchive & archive) const
inlineoverridevirtual

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

Implements ISerializable.

◆ SetCustomType()

void SetCustomType ( const std::string & type)

Sets the custom type of the module for serialization purposes.

Parameters
typeA string representing the module's type.
Since
ids_peak_icv 1.0

◆ SetEnabled()

void SetEnabled ( bool enabled)
inlineoverridevirtual

Enables or disables the module.

Parameters
enabledSet to true to enable, or false to disable.
Since
ids_peak_icv 1.0

Implements IModule.

◆ SetMode()

void SetMode ( const DownsamplingMode & mode)
inline

Sets the DownsamplingMode.

Parameters
modeThe DownsamplingMode to set.
Since
ids_peak_icv 1.0

◆ SetX()

void SetX ( uint32_t x)
inline

Sets the number of columns to downsample.

Parameters
xThe number of columns to downsample.
Since
ids_peak_icv 1.0

◆ SetY()

void SetY ( uint32_t y)
inline

Sets the number of rows to downsample.

Parameters
yThe number of rows to downsample.
Since
ids_peak_icv 1.0