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

Public Member Functions

None __init__ (self)
 Creates an instance of the gain module.
 
None __del__ (self)
 
str type (self)
 Returns the type of the module for serialization purposes.
 
None reset_to_default (self)
 Resets all gain values to defaults.
 
float master (self)
 Returns the current master gain value.
 
None master (self, float value)
 Sets the master gain.
 
float red (self)
 Returns the current red gain value.
 
None red (self, float value)
 Sets the red channel gain.
 
float green (self)
 Returns the current green gain value.
 
None green (self, float value)
 Sets the green channel gain.
 
float blue (self)
 Returns the current blue gain value.
 
None blue (self, float value)
 Sets the blue channel gain.
 
Interval range (self)
 Returns the valid range for all gain values.
 
Image process (self, Image input_image)
 Processes the input image by applying gain correction (if enabled).
 
None serialize (self, IArchive archive)
 Serializes the module’s internal state into an archive.
 
None deserialize (self, IArchive archive)
 Restores the module’s state from an archive.
 

Data Fields

 master
 
 red
 
 green
 
 blue
 

Static Public Attributes

float DEFAULT_MASTER = 1.0
 
float DEFAULT_RED = 1.0
 
float DEFAULT_GREEN = 1.0
 
float DEFAULT_BLUE = 1.0
 
list SUPPORTED_PIXEL_FORMATS
 

Protected Member Functions

None _apply (self, _GainType gain_type, float value)
 
float _fetch (self, _GainType gain_type)
 

Protected Attributes

float _master = self.DEFAULT_MASTER
 
float _red = self.DEFAULT_RED
 
float _green = self.DEFAULT_GREEN
 
float _blue = self.DEFAULT_BLUE
 
 _handle = ctypes.c_void_p()
 
 _enabled
 

Detailed Description

Gain is an image pipeline module that applies gain correction to an image.

This module adjusts the intensity or color gain of an image by modifying the master and per-channel (R, G, B) gain factors. It can be used to correct image brightness or color balance after acquisition.

The gain correction is applied independently to each channel, and is typically used as part of the early preprocessing stages of an image pipeline.

Default configuration:

  • Master gain = 1.0
  • Red gain = 1.0
  • Green gain = 1.0
  • Blue gain = 1.0
Since
ids_peak_icv 1.0

Definition at line 21 of file gain_module.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self)

Creates an instance of the gain module.

Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 81 of file gain_module.py.

◆ __del__()

None __del__ ( self)

Definition at line 100 of file gain_module.py.

Member Function Documentation

◆ _apply()

None _apply ( self,
_GainType gain_type,
float value )
protected

Definition at line 294 of file gain_module.py.

◆ _fetch()

float _fetch ( self,
_GainType gain_type )
protected

Definition at line 302 of file gain_module.py.

◆ blue() [1/2]

float blue ( self)

Returns the current blue gain value.

Since
ids_peak_icv 1.0

Reimplemented from IGain.

Definition at line 197 of file gain_module.py.

◆ blue() [2/2]

None blue ( self,
float value )

Sets the blue channel gain.

Parameters
valueGain value within valid range.
Since
ids_peak_icv 1.0

Reimplemented from IGain.

Definition at line 206 of file gain_module.py.

◆ deserialize()

None deserialize ( self,
IArchive archive )

Restores the module’s state from an archive.

Parameters
archiveArchive containing the serialized state.
Exceptions
CorruptedExceptionIf the archive is malformed.
NotSupportedExceptionIf version is unsupported.
Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 276 of file gain_module.py.

◆ green() [1/2]

float green ( self)

Returns the current green gain value.

Since
ids_peak_icv 1.0

Reimplemented from IGain.

Definition at line 176 of file gain_module.py.

◆ green() [2/2]

None green ( self,
float value )

Sets the green channel gain.

Parameters
valueGain value within valid range.
Since
ids_peak_icv 1.0

Reimplemented from IGain.

Definition at line 185 of file gain_module.py.

◆ master() [1/2]

float master ( self)

Returns the current master gain value.

Since
ids_peak_icv 1.0

Reimplemented from IGain.

Definition at line 133 of file gain_module.py.

◆ master() [2/2]

None master ( self,
float value )

Sets the master gain.

Parameters
valueGain value within the valid range returned by :py:meth:range.
Exceptions
OutOfRangeExceptionIf value is outside the valid range.
Since
ids_peak_icv 1.0

Reimplemented from IGain.

Definition at line 142 of file gain_module.py.

◆ process()

Image process ( self,
Image input_image )

Processes the input image by applying gain correction (if enabled).

Supported pixel formats
  • Mono8
  • Mono10
  • Mono12
  • Mono16
  • BayerBG8
  • BayerBG10
  • BayerBG12
  • BayerGB8
  • BayerGB10
  • BayerGB12
  • BayerRG8
  • BayerRG10
  • BayerRG12
  • BayerGR8
  • BayerGR10
  • BayerGR12

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

Parameters
input_imageInput image to be processed.
Returns
Processed output image.
Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 237 of file gain_module.py.

◆ range()

Interval range ( self)

Returns the valid range for all gain values.

The range applies to master and per-channel gains.

Returns
Interval representing the valid min/max gain values.
Since
ids_peak_icv 1.0

Definition at line 218 of file gain_module.py.

◆ red() [1/2]

float red ( self)

Returns the current red gain value.

Since
ids_peak_icv 1.0

Reimplemented from IGain.

Definition at line 155 of file gain_module.py.

◆ red() [2/2]

None red ( self,
float value )

Sets the red channel gain.

Parameters
valueGain value within valid range.
Since
ids_peak_icv 1.0

Reimplemented from IGain.

Definition at line 164 of file gain_module.py.

◆ reset_to_default()

None reset_to_default ( self)

Resets all gain values to defaults.

Master, Red, Green, and Blue gains are all reset to 1.0.

Since
ids_peak_icv 1.0

Reimplemented from IModule.

Definition at line 114 of file gain_module.py.

◆ serialize()

None serialize ( self,
IArchive archive )

Serializes the module’s internal state into an archive.

Returns
Serialized archive containing all parameters.
Since
ids_peak_icv 1.0

Reimplemented from ModuleBase.

Definition at line 262 of file gain_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 105 of file gain_module.py.

Field Documentation

◆ _blue

_blue = self.DEFAULT_BLUE
protected

Definition at line 92 of file gain_module.py.

◆ _enabled

_enabled
protected

Definition at line 248 of file gain_module.py.

◆ _green

_green = self.DEFAULT_GREEN
protected

Definition at line 91 of file gain_module.py.

◆ _handle

_handle = ctypes.c_void_p()
protected

Definition at line 94 of file gain_module.py.

◆ _master

_master = self.DEFAULT_MASTER
protected

Definition at line 89 of file gain_module.py.

◆ _red

_red = self.DEFAULT_RED
protected

Definition at line 90 of file gain_module.py.

◆ blue

blue

Definition at line 274 of file gain_module.py.

◆ DEFAULT_BLUE

float DEFAULT_BLUE = 1.0
static

Definition at line 67 of file gain_module.py.

◆ DEFAULT_GREEN

float DEFAULT_GREEN = 1.0
static

Definition at line 59 of file gain_module.py.

◆ DEFAULT_MASTER

float DEFAULT_MASTER = 1.0
static

Definition at line 43 of file gain_module.py.

◆ DEFAULT_RED

float DEFAULT_RED = 1.0
static

Definition at line 51 of file gain_module.py.

◆ green

green

Definition at line 273 of file gain_module.py.

◆ master

master

Definition at line 271 of file gain_module.py.

◆ red

red

Definition at line 272 of file gain_module.py.

◆ SUPPORTED_PIXEL_FORMATS

SUPPORTED_PIXEL_FORMATS
static
Initial value:
= [PixelFormat.BAYER_RG_8, PixelFormat.BAYER_RG_10, PixelFormat.BAYER_RG_12,
PixelFormat.BAYER_GR_8, PixelFormat.BAYER_GR_10, PixelFormat.BAYER_GR_12,
PixelFormat.BAYER_BG_8, PixelFormat.BAYER_BG_10, PixelFormat.BAYER_BG_12,
PixelFormat.BAYER_GB_8, PixelFormat.BAYER_GB_10, PixelFormat.BAYER_GB_12,
PixelFormat.MONO_8, PixelFormat.MONO_10, PixelFormat.MONO_12, PixelFormat.MONO_16]

Definition at line 75 of file gain_module.py.