IDS peak IPL v1.17.0
Loading...
Searching...
No Matches
peak::ipl::Lut Class Referencefinal

Applies a LUT to the input image data. More...

#include <peak_ipl/algorithm/peak_ipl_lut.hpp>

Public Types

enum class  Channel {
  Red = 0 ,
  Green = 1 ,
  Blue = 2 ,
  All = 3
}
 Channel parameter to select the channel where the operation is applied. More...
 
enum class  Selector {
  Lut_8Bit = 0 ,
  Lut_10Bit = 1 ,
  Lut_12Bit = 2 ,
  Lut_16Bit = 3
}
 Selector parameter to select to which LUT the operation is applied (8/10/12/16 bit LUT). During processing, the LUT is selected based on the pixel format. More...
 
enum class  Preset {
  Identity = 0 ,
  Inverse = 1 ,
  Jet = 2 ,
  Hot = 3 ,
  Rainbow = 4 ,
  OnlyRed = 5 ,
  OnlyGreen = 6 ,
  OnlyBlue = 7 ,
  DigitalGain2 = 8 ,
  DigitalBlack25Percent = 9 ,
  Binarize = 10
}
 Preset Selects a predefined LUT. More...
 

Public Member Functions

 Lut ()
 Constructor for a new LUT instance.
 
 ~Lut ()
 Destructor for the LUT instance.
 
 Lut (const Lut &other)
 Copy Constructor for a new LUT instance.
 
Lut & operator= (const Lut &other)
 Copy assigment for LUT instance.
 
 Lut (Lut &&other) noexcept
 Move constructor for Lut instance.
 
Lut & operator= (Lut &&other) noexcept
 Move assignment for Lut instance.
 
uint32_t LutValue (Selector selector, Channel channel, uint32_t index) const
 Reads a single LUT value for a given selector and channel at an indexed position.
 
void SetLutValue (Selector selector, Channel channel, uint32_t index, uint32_t value)
 Sets a single LUT value for a given selector and channel at an indexed position.
 
std::vector< uint32_t > AllLutValues (Selector selector, Channel channel) const
 Reads all LUT values for a given selector and channel at once.
 
void SetAllLutValues (Selector selector, Channel channel, const std::vector< uint32_t > &values)
 Sets all LUT values for a given selector and channel at once.
 
void SetLutPreset (Selector selector, Preset preset)
 Applies the given preset (identity, inverse, ...) to the specified LUT.
 
bool IsPixelFormatSupported (PixelFormatName pixelFormatName) const
 Returns whether the LUT supports the given pixel format.
 
void ProcessInPlace (Image &image) const
 Applies the LUT to the given image in place that is, it will change the input image.
 
Image Process (const Image &inputImage) const
 Applies the LUT to the given image.
 

Detailed Description

Applies a LUT to the input image data.

In image processing, lookup tables (LUTs) are used to map input pixel values to new output values, enabling efficient transformations of image data. They are commonly used for tasks like color correction, contrast adjustment, and brightness modification. Instead of recalculating values for each pixel, LUTs allow quick retrieval of precomputed results, speeding up processing. LUTs are particularly effective in enhancing visual effects or applying filters without altering the image's underlying structure.

A custom lookup table (LUT) can be defined or one of several predefined LUTs can be applied. For all available predefined LUTs see enum class Preset. The LUT can be configured independently for each bit depth. Depending on the image's bit depth, the corresponding LUT is applied. Ensure that the correct LUT is configured for the bit depth you intend to use.

Note
When processing monochrome images, only the red channel of the LUT is utilized, which may not produce the expected result.
Since
1.15

Member Enumeration Documentation

◆ Channel

enum class peak::ipl::Lut::Channel
strong

Channel parameter to select the channel where the operation is applied.

Enumerator
Red 

Only operate on the red channel

Green 

Only operate on the green channel

Blue 

Only operate on the blue channel

All 

Operate on all channels simultaniously

◆ Preset

enum class peak::ipl::Lut::Preset
strong

Preset Selects a predefined LUT.

Enumerator
Identity 

This is the default LUT which does not change any pixel values. Each input pixel value will be converted to the exact output pixel value. When choosing this preset no calculations will be performed.

Inverse 

This LUT inverts all pixel values. The highest pixel value will be converted to the lowest one and vice versa.

Jet 

This LUT creates a custom color mapping where the red, green, and blue channels gradually change across different ranges, producing a smooth transition from dark to light. It adjusts each color channel in a pattern that could be used for unique color grading or effects.

Hot 

This LUT creates a color transition where the red channel gradually increases, the green channel increases after the red, and finally, the blue channel increases in the last section. It results in a smooth shift from red to green and then to blue, producing a color gradient effect across the RGB channels.

Rainbow 

This LUT creates a rainbow effect by smoothly transitioning the red, green, and blue channels through specific color ranges. It produces a gradual shift from red to green to blue, and then cycles back through the colors to create a full spectrum effect.

OnlyRed 

This LUT will only allow red pixels to be shown. This is achieved by converting all pixel values of any other channel to 0.

OnlyGreen 

This LUT will only allow green pixels to be shown. This is achieved by converting all pixel values of any other channel to 0.

OnlyBlue 

This LUT will only allow blue pixels to be shown. This is achieved by converting all pixel values of any other channel to 0.

DigitalGain2 

This LUT will multiply each pixel value by 2 resulting in a gain like adjustment.

DigitalBlack25Percent 

This LUT will apply a digital black function. See peak::ipl::GammaCorrector::SetDigitalBlack for more information.

Binarize 

The LUT converts the image to black and white by clamping pixel values below the midpoint to 0 (black) and those above to the maximum value (white).

◆ Selector

enum class peak::ipl::Lut::Selector
strong

Selector parameter to select to which LUT the operation is applied (8/10/12/16 bit LUT). During processing, the LUT is selected based on the pixel format.

Enumerator
Lut_8Bit 

Operate on the 8 bit LUT

Lut_10Bit 

Operate on the 10 bit LUT

Lut_12Bit 

Operate on the 12 bit LUT

Lut_16Bit 

Operate on the 16 bit LUT

Constructor & Destructor Documentation

◆ Lut() [1/3]

peak::ipl::Lut::Lut ( )
inline

Constructor for a new LUT instance.

Creates a new LUT instance.

Since
1.15

◆ ~Lut()

peak::ipl::Lut::~Lut ( )
inline

Destructor for the LUT instance.

Destroys a LUT instance.

Since
1.15

◆ Lut() [2/3]

peak::ipl::Lut::Lut ( const Lut & other)
inline

Copy Constructor for a new LUT instance.

Creates a new LUT instance.

Note
This only creates a shallow copy. See Shallow copy (since 1.8) for a detailed explanation.
Parameters
[in]otherThe other instance to acquire a reference for.
Since
1.15

◆ Lut() [3/3]

peak::ipl::Lut::Lut ( Lut && other)
inlinenoexcept

Move constructor for Lut instance.

Moves the instance from other to this. Afterwards other is invalid.

Parameters
[in]otherThe other instance to move.
Since
1.15

Member Function Documentation

◆ AllLutValues()

std::vector< uint32_t > peak::ipl::Lut::AllLutValues ( Selector selector,
Channel channel ) const
inline

Reads all LUT values for a given selector and channel at once.

Returns
All values in a vector.
Parameters
[in]selectorThe selected LUT (8, 10, 12, 16 bit)
[in]channelThe channel where the new values are set
Exceptions
InvalidArgumentfor values out of range or wrong vector size.
Since
1.15

◆ IsPixelFormatSupported()

bool peak::ipl::Lut::IsPixelFormatSupported ( PixelFormatName pixelFormatName) const
inline

Returns whether the LUT supports the given pixel format.

Returns
Whether the given pixel format is supported.
Parameters
[in]pixelFormatNameThe pixel format of interest.
Since
1.15

◆ LutValue()

uint32_t peak::ipl::Lut::LutValue ( Selector selector,
Channel channel,
uint32_t index ) const
inline

Reads a single LUT value for a given selector and channel at an indexed position.

Returns
The LUT value at the indexed position.
Parameters
[in]selectorThe selected LUT (8, 10, 12, 16 bit)
[in]channelThe channel from where the value is read
[in]indexThe index of the LUT value
Since
1.15

◆ operator=() [1/2]

Lut & peak::ipl::Lut::operator= ( const Lut & other)
inline

Copy assigment for LUT instance.

Acquires a reference from other to this instance. If this instance already has a reference, it will be destroyed.

Note
See Shallow copy (since 1.8) for a detailed explanation.
Parameters
[in]otherThe other instance to acquire a reference for.
Since
1.15

◆ operator=() [2/2]

Lut & peak::ipl::Lut::operator= ( Lut && other)
inlinenoexcept

Move assignment for Lut instance.

Moves the instance from other to this. Afterwards other is invalid.

Parameters
[in]otherThe other instance to move.
Since
1.15

◆ Process()

Image peak::ipl::Lut::Process ( const Image & inputImage) const
inline

Applies the LUT to the given image.

Parameters
[in]inputImageImage to process.
Note
Will not work with packed pixel formats. See Packed pixel format handling for the correct handling of this.
Returns
A new created image with applied LUT.
Exceptions
ImageFormatNotSupportedExceptionimage has unsupported pixel format.
Since
1.15

◆ ProcessInPlace()

void peak::ipl::Lut::ProcessInPlace ( Image & image) const
inline

Applies the LUT to the given image in place that is, it will change the input image.

Parameters
[in]imageImage to process.
Note
Will not work with packed pixel formats. See Packed pixel format handling for the correct handling of this.
Exceptions
ImageFormatNotSupportedExceptionimage has unsupported pixel format.
Since
1.15

◆ SetAllLutValues()

void peak::ipl::Lut::SetAllLutValues ( Selector selector,
Channel channel,
const std::vector< uint32_t > & values )
inline

Sets all LUT values for a given selector and channel at once.

Parameters
[in]selectorThe selected LUT (8, 10, 12, 16 bit)
[in]channelThe channel where the new values are set
[in]valuesVector with LUT values
Exceptions
InvalidArgumentfor values out of range or wrong vector size.
Since
1.15

◆ SetLutPreset()

void peak::ipl::Lut::SetLutPreset ( Selector selector,
Preset preset )
inline

Applies the given preset (identity, inverse, ...) to the specified LUT.

Parameters
[in]selectorThe selected LUT (8, 10, 12, 16 bit)
[in]presetThe predefined LUT to be set
Since
1.15

◆ SetLutValue()

void peak::ipl::Lut::SetLutValue ( Selector selector,
Channel channel,
uint32_t index,
uint32_t value )
inline

Sets a single LUT value for a given selector and channel at an indexed position.

Parameters
[in]selectorThe selected LUT (8, 10, 12, 16 bit)
[in]channelThe channel where the new value is set
[in]indexThe index of the LUT value
[in]valueThe LUT value at indexed position to be set
Exceptions
InvalidArgumentfor values or indexes out of range.
Since
1.15

The documentation for this class was generated from the following file: