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

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

Inheritance diagram for DownsamplingModule:
Collaboration 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
 Sets the enabled state of this module.
 
bool IsEnabled () const override
 Checks if the 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 default values.
 
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
1.0

Definition at line 111 of file peak_icv_downsampling_module.hpp.

Constructor & Destructor Documentation

◆ DownsamplingModule() [1/4]

DownsamplingModule ( )
inlineexplicit

Creates a DownsamplingModule with default values.

Since
1.0

Definition at line 358 of file peak_icv_downsampling_module.hpp.

◆ 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
1.0

Definition at line 362 of file peak_icv_downsampling_module.hpp.

◆ ~DownsamplingModule()

~DownsamplingModule ( )
inlineoverride
Since
1.0

Definition at line 372 of file peak_icv_downsampling_module.hpp.

◆ 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
1.0

◆ DownsamplingModule() [4/4]

DownsamplingModule ( DownsamplingModule && other)
inlinenoexcept
Since
1.0

Definition at line 380 of file peak_icv_downsampling_module.hpp.

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 'Version' entry in archive is missing, malformed, or indicates an unsupported version.
Note
This function requires that the archive contains all expected fields as produced by a corresponding Serialize() call.
Since
1.0

Implements ISerializable.

Definition at line 429 of file peak_icv_downsampling_module.hpp.

◆ GetMode()

DownsamplingMode GetMode ( ) const
inline

Returns the current DownsamplingMode.

Returns
The current DownsamplingMode.
Since
1.0

Definition at line 553 of file peak_icv_downsampling_module.hpp.

◆ GetRange()

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

Returns the valid range for downsampling factors x and y.

Returns
The valid range.
Since
1.0

Definition at line 534 of file peak_icv_downsampling_module.hpp.

◆ 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
1.0

Implements IModule.

Definition at line 481 of file peak_icv_downsampling_module.hpp.

◆ GetX()

uint32_t GetX ( ) const
inline

Returns the current number of columns used for downsampling.

Returns
The current number of columns to downsample.
Since
1.0

Definition at line 512 of file peak_icv_downsampling_module.hpp.

◆ GetY()

uint32_t GetY ( ) const
inline

Returns the current number of rows used for downsampling.

Returns
The current number of rows to downsample.
Since
1.0

Definition at line 523 of file peak_icv_downsampling_module.hpp.

◆ IsEnabled()

bool IsEnabled ( ) const
inlineoverridevirtual

Checks if the module is currently enabled.

Returns
True if the module is enabled, false otherwise.
Since
1.0

Implements IModule.

Definition at line 410 of file peak_icv_downsampling_module.hpp.

◆ 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
1.0

◆ operator=() [2/2]

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

Definition at line 386 of file peak_icv_downsampling_module.hpp.

◆ 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.

Note
Supported pixel formats: BayerGR8, BayerGR10, BayerGR12, BayerRG8, BayerRG10, BayerRG12, BayerGB8, BayerGB10, BayerGB12, BayerBG8, BayerBG10, BayerBG12, Mono8, Mono10, Mono12, Mono16, RGB8, RGB10, RGB12, BGR8, BGR10, BGR12, RGBa8, RGBa10, RGBa12, BGRa8, BGRa10, BGRa12.
This operation disregards any specified image regions and processes the entire image.
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
1.0

Implements IModule.

Definition at line 448 of file peak_icv_downsampling_module.hpp.

◆ 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.

Note
Supported pixel formats: BayerGR8, BayerGR10, BayerGR12, BayerRG8, BayerRG10, BayerRG12, BayerGB8, BayerGB10, BayerGB12, BayerBG8, BayerBG10, BayerBG12, Mono8, Mono10, Mono12, Mono16, RGB8, RGB10, RGB12, BGR8, BGR10, BGR12, RGBa8, RGBa10, RGBa12, BGRa8, BGRa10, BGRa12.
This operation disregards any specified image regions and processes the entire image.
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
1.0

Definition at line 443 of file peak_icv_downsampling_module.hpp.

◆ ResetToDefault()

void ResetToDefault ( )
inlineoverridevirtual

Resets all settings to default values.

Since
1.0

Implements IModule.

Definition at line 490 of file peak_icv_downsampling_module.hpp.

◆ 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
1.0

Implements ISerializable.

Definition at line 415 of file peak_icv_downsampling_module.hpp.

◆ 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
1.0

◆ SetEnabled()

void SetEnabled ( bool enabled)
inlineoverridevirtual

Sets the enabled state of this module.

Parameters
enabledIf true, the module is enabled; otherwise, it is disabled.
Since
1.0

Implements IModule.

Definition at line 405 of file peak_icv_downsampling_module.hpp.

◆ SetMode()

void SetMode ( const DownsamplingMode & mode)
inline

Sets the DownsamplingMode.

Parameters
modeThe DownsamplingMode to set.
Since
1.0

Definition at line 545 of file peak_icv_downsampling_module.hpp.

◆ SetX()

void SetX ( uint32_t x)
inline

Sets the number of columns to downsample.

Parameters
xThe number of columns to downsample.
Since
1.0

Definition at line 498 of file peak_icv_downsampling_module.hpp.

◆ SetY()

void SetY ( uint32_t y)
inline

Sets the number of rows to downsample.

Parameters
yThe number of rows to downsample.
Since
1.0

Definition at line 505 of file peak_icv_downsampling_module.hpp.