IDS peak ICV v1.2.0
Loading...
Searching...
No Matches
GainModule Class Referencefinal

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

Inheritance diagram for GainModule:

Public Member Functions

 GainModule ()
 Creates an instance of class GainModule with default values.
 
 ~GainModule () override
 
 GainModule (const GainModule &other)=delete
 Copy constructor for class GainModule is deleted.
 
 GainModule (GainModule &&other) noexcept
 
GainModule & operator= (const GainModule &other)=delete
 Copy assignment for class GainModule is deleted.
 
GainModule & operator= (GainModule &&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.
 
const char * GetType () const override
 Returns the type of the module for serialization purposes.
 
void ResetToDefault () override
 Resets the gain values to their defaults.
 
void SetMaster (float value) override
 Sets the master gain value.
 
float GetMaster () const override
 Returns the current master gain.
 
void SetRed (float value) override
 Sets the red gain value.
 
float GetRed () const override
 Returns the current red gain.
 
void SetGreen (float value) override
 Sets the green gain value.
 
float GetGreen () const override
 Returns the current green gain.
 
void SetBlue (float value) override
 Sets the blue gain value.
 
float GetBlue () const override
 Returns the current blue gain.
 
peak::common::IntervalF GetRange () const
 Returns the valid range for the master or color gains.
 
peak::icv::Image Process (const peak::icv::Image &input) const
 Applies the gains to the input image in place and returns a reference to the modified image.
 
peak::common::Any Process (const peak::common::Any &input) const override
 Applies the gains to the input image in place and returns a reference to the modified image.
 

Detailed Description

Image pipeline module for applying gain to the image.

Gain is used to adjust pixel intensities either uniformly across all color channels using the master gain, or individually per channel using the red, green, and blue gains. With master gain, image brightness can be increased. With color gains, the white balance can be adjusted.

For color images, gain is applied as follows:

red_value_out = red_value_in * red_gain * master_gain
green_value_out = green_value_in * green_gain * master_gain
blue_value_out = blue_value_in * blue_gain * master_gain

where red_value_in, green_value_in, and blue_value_in are the input red, green, and blue channel values, respectively, and red_value_out, green_value_out, and blue_value_out are the corresponding output values. All RGB values are normalized to the range [0.0, 1.0].

For mono images, the color gains are ignored and applied as follows:

gray_value_out = gray_value_in * master_gain

where gray_value_in is the input and gray_value_out the output value, normalized to the range [0.0, 1.0].

Warning
Excessive gain values may cause clipping and loss of image detail in bright areas.

Defaults
  • red_gain = 1.0
  • green_gain = 1.0
  • blue_gain = 1.0
  • master_gain = 1.0
See also
features::DigitalBlackFeature, features::GammaFeature
Since
ids_peak_icv 1.0

Definition at line 34 of file peak_icv_gain_module.hpp.

Constructor & Destructor Documentation

◆ GainModule() [1/3]

GainModule ( )
inline

Creates an instance of class GainModule with default values.

Since
ids_peak_icv 1.0

Definition at line 310 of file peak_icv_gain_module.hpp.

◆ ~GainModule()

~GainModule ( )
inlineoverride
Since
ids_peak_icv 1.0

Definition at line 317 of file peak_icv_gain_module.hpp.

◆ GainModule() [2/3]

GainModule ( const GainModule & other)
delete

Copy constructor for class GainModule 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

◆ GainModule() [3/3]

GainModule ( GainModule && other)
inlinenoexcept
Since
ids_peak_icv 1.0

Definition at line 325 of file peak_icv_gain_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 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.

Definition at line 370 of file peak_icv_gain_module.hpp.

◆ GetBlue()

float GetBlue ( ) const
inlineoverridevirtual

Returns the current blue gain.

Returns
The current blue gain.
Since
ids_peak_icv 1.0

Implements IGain.

Definition at line 433 of file peak_icv_gain_module.hpp.

◆ GetGreen()

float GetGreen ( ) const
inlineoverridevirtual

Returns the current green gain.

Returns
The current green gain.
Since
ids_peak_icv 1.0

Implements IGain.

Definition at line 423 of file peak_icv_gain_module.hpp.

◆ GetMaster()

float GetMaster ( ) const
inlineoverridevirtual

Returns the current master gain.

Returns
The current master gain.
Since
ids_peak_icv 1.0

Implements IGain.

Definition at line 403 of file peak_icv_gain_module.hpp.

◆ GetRange()

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

Returns the valid range for the master or color gains.

Provides the minimum and maximum values that are accepted by the SetMaster, SetRed, SetGreen and the SetBlue functions.

Returns
The interval containing the minimum and maximum valid gain values.
Since
ids_peak_icv 1.0

Definition at line 438 of file peak_icv_gain_module.hpp.

◆ GetRed()

float GetRed ( ) const
inlineoverridevirtual

Returns the current red gain.

Returns
The current red gain.
Since
ids_peak_icv 1.0

Implements IGain.

Definition at line 413 of file peak_icv_gain_module.hpp.

◆ GetType()

const char * GetType ( ) const
inlineoverridevirtual

Returns the type of the module for serialization purposes.

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

Implements IModule.

Definition at line 384 of file peak_icv_gain_module.hpp.

◆ IsEnabled()

bool IsEnabled ( ) const
inlineoverridevirtual

Checks if the module is currently enabled.

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

Implements IModule.

Definition at line 354 of file peak_icv_gain_module.hpp.

◆ operator=() [1/2]

GainModule & operator= ( const GainModule & other)
delete

Copy assignment for class GainModule 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]

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

Definition at line 331 of file peak_icv_gain_module.hpp.

◆ Process() [1/2]

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

Applies the gains to the input image in place and returns a reference to the modified image.

The correction is performed based on the current configuration of the module. The operation modifies the input image directly and does not create a copy.

Note
Supported pixel formats: BayerRG8, BayerRG10, BayerRG12, BayerGR8, BayerGR10, BayerGR12, BayerBG8, BayerBG10, BayerBG12, BayerGB8, BayerGB10, BayerGB12, Mono8, Mono10, Mono12, Mono16.
This operation disregards any specified image regions and processes the entire image.
Parameters
inputThe input image to be processed and corrected.
Returns
A reference to the input image after in-place gain correction.
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.

Definition at line 453 of file peak_icv_gain_module.hpp.

◆ Process() [2/2]

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

Applies the gains to the input image in place and returns a reference to the modified image.

The correction is performed based on the current configuration of the module. The operation modifies the input image directly and does not create a copy.

Note
Supported pixel formats: BayerRG8, BayerRG10, BayerRG12, BayerGR8, BayerGR10, BayerGR12, BayerBG8, BayerBG10, BayerBG12, BayerGB8, BayerGB10, BayerGB12, Mono8, Mono10, Mono12, Mono16.
This operation disregards any specified image regions and processes the entire image.
Parameters
inputThe input image to be processed and corrected.
Returns
A reference to the input image after in-place gain correction.
Exceptions
NotSupportedExceptionIf image has any other than the supported pixel formats.
Since
ids_peak_icv 1.0

Definition at line 448 of file peak_icv_gain_module.hpp.

◆ ResetToDefault()

void ResetToDefault ( )
inlineoverridevirtual

Resets the gain values to their defaults.

Since
ids_peak_icv 1.0

Implements IModule.

Definition at line 389 of file peak_icv_gain_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
ids_peak_icv 1.0

Implements ISerializable.

Definition at line 359 of file peak_icv_gain_module.hpp.

◆ SetBlue()

void SetBlue ( float value)
inlineoverridevirtual

Sets the blue gain value.

Sets the color gain for the blue channel. The valid range for the gain value can be obtained using the GetRange function.

Parameters
valueThe blue gain value to set.
Exceptions
peak::icv::OutOfRangeExceptionIf the gain value is outside the valid range.
Since
ids_peak_icv 1.0

Implements IGain.

Definition at line 428 of file peak_icv_gain_module.hpp.

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

Implements IModule.

Definition at line 349 of file peak_icv_gain_module.hpp.

◆ SetGreen()

void SetGreen ( float value)
inlineoverridevirtual

Sets the green gain value.

Sets the color gain for the green channel. The valid range for the gain value can be obtained using the GetRange function.

Parameters
valueThe green gain value to set.
Exceptions
peak::icv::OutOfRangeExceptionIf the gain value is outside the valid range.
Since
ids_peak_icv 1.0

Implements IGain.

Definition at line 418 of file peak_icv_gain_module.hpp.

◆ SetMaster()

void SetMaster ( float value)
inlineoverridevirtual

Sets the master gain value.

Sets the overall master gain. The valid range for the gain value can be obtained using the GetRange function.

Parameters
valueThe master gain value to set.
Exceptions
peak::icv::OutOfRangeExceptionIf the gain value is outside the valid range.
Since
ids_peak_icv 1.0

Implements IGain.

Definition at line 398 of file peak_icv_gain_module.hpp.

◆ SetRed()

void SetRed ( float value)
inlineoverridevirtual

Sets the red gain value.

Sets the color gain for the red channel. The valid range for the gain value can be obtained using the GetRange function.

Parameters
valueThe red gain value to set.
Exceptions
peak::icv::OutOfRangeExceptionIf the gain value is outside the valid range.
Since
ids_peak_icv 1.0

Implements IGain.

Definition at line 408 of file peak_icv_gain_module.hpp.