libcamera  v0.5.0
Supporting cameras in Linux since 2019
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
libcamera::ipa::AwbAlgorithm Class Referenceabstract

A base class for auto white balance algorithms. More...

Inheritance diagram for libcamera::ipa::AwbAlgorithm:
Inheritance graph
[legend]

Classes

class  ModeConfig
 Holds the configuration of a single AWB mode. More...
 

Public Member Functions

virtual int init (const YamlObject &tuningData)=0
 Initialize the algorithm with the given tuning data. More...
 
virtual AwbResult calculateAwb (const AwbStats &stats, unsigned int lux)=0
 Calculate AWB data from the given statistics. More...
 
virtual RGB< double > gainsFromColourTemperature (double colourTemperature)=0
 Compute white balance gains from a colour temperature. More...
 
const ControlInfoMap::Mapcontrols () const
 Get the controls info map for this algorithm. More...
 
virtual void handleControls ([[maybe_unused]] const ControlList &controls)
 Handle the controls supplied in a request. More...
 

Protected Member Functions

int parseModeConfigs (const YamlObject &tuningData, const ControlValue &def={})
 Parse the mode configurations from the tuning data. More...
 

Protected Attributes

ControlInfoMap::Map controls_
 Controls info map for the controls provided by the algorithm.
 
std::map< controls::AwbModeEnum, AwbAlgorithm::ModeConfigmodes_
 Map of all configured modes. More...
 

Detailed Description

A base class for auto white balance algorithms.

This class is a base class for auto white balance algorithms. It defines an interface for the algorithms to implement, and is used by the IPAs to interact with the concrete implementation.

Member Function Documentation

◆ calculateAwb()

libcamera::ipa::AwbAlgorithm::calculateAwb ( const AwbStats stats,
unsigned int  lux 
)
pure virtual

Calculate AWB data from the given statistics.

Parameters
[in]statsThe statistics to use for the calculation
[in]luxThe lux value of the scene

Calculate an AwbResult object from the given statistics and lux value. A lux value of 0 means it is unknown or invalid and the algorithm shall ignore it.

Returns
The AWB result

Implemented in libcamera::ipa::AwbBayes, and libcamera::ipa::AwbGrey.

◆ controls()

libcamera::ipa::AwbAlgorithm::controls ( ) const
inline

Get the controls info map for this algorithm.

Returns
The controls info map

◆ gainsFromColourTemperature()

libcamera::ipa::AwbAlgorithm::gainsFromColourTemperature ( double  colourTemperature)
pure virtual

Compute white balance gains from a colour temperature.

Parameters
[in]colourTemperatureThe colour temperature in Kelvin

Compute the white balance gains from a colourTemperature. This function does not take any statistics into account. It is used to compute the colour gains when the user manually specifies a colour temperature.

Returns
The colour gains

Implemented in libcamera::ipa::AwbBayes, and libcamera::ipa::AwbGrey.

◆ handleControls()

libcamera::ipa::AwbAlgorithm::handleControls ( [[maybe_unused] ] const ControlList controls)
inlinevirtual

Handle the controls supplied in a request.

Parameters
[in]controlsThe controls to handle

◆ init()

libcamera::ipa::AwbAlgorithm::init ( const YamlObject tuningData)
pure virtual

Initialize the algorithm with the given tuning data.

Parameters
[in]tuningDataThe tuning data to use for the algorithm
Returns
0 on success, a negative error code otherwise

Implemented in libcamera::ipa::AwbBayes, and libcamera::ipa::AwbGrey.

◆ parseModeConfigs()

int libcamera::ipa::AwbAlgorithm::parseModeConfigs ( const YamlObject tuningData,
const ControlValue def = {} 
)
protected

Parse the mode configurations from the tuning data.

Parameters
[in]tuningDatathe YamlObject representing the tuning data
[in]defThe default value for the AwbMode control

Utility function to parse the tuning data for an AwbMode entry and read all provided modes. It adds controls::AwbMode to AwbAlgorithm::controls_ and populates AwbAlgorithm::modes_. For a list of possible modes see controls::AwbModeEnum.

Each mode entry must contain a "lo" and "hi" key to specify the lower and upper colour temperature of that mode. For example:

algorithms:
- Awb:
AwbMode:
AwbAuto:
lo: 2500
hi: 8000
AwbIncandescent:
lo: 2500
hi: 3000
...

If def is supplied but not contained in the the tuningData, -EINVAL is returned.

See also
controls::AwbModeEnum
Returns
Zero on success, negative error code otherwise

Member Data Documentation

◆ modes_

libcamera::ipa::AwbAlgorithm::modes_
protected

Map of all configured modes.

See also
AwbAlgorithm::parseModeConfigs

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