libcamera v0.7.2 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
libcamera::ipa::AwbAlgorithm Class Referenceabstract

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

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

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

## Public Member Functions
virtual int | init (const ValueNode &tuningData)=0
| Initialize the algorithm with the given tuning data.
virtual AwbResult | calculateAwb (const AwbStats &stats, unsigned int lux)=0
| Calculate AWB data from the given statistics.
virtual std::optional< RGB< double > > | gainsFromColourTemperature (double colourTemperature)=0
| Compute white balance gains from a colour temperature.
const ControlInfoMap::Map & | controls () const
| Get the controls info map for this algorithm.
virtual void | handleControls (const ControlList &controls)
| Handle the controls supplied in a request.

## Protected Member Functions
int | parseModeConfigs (const ValueNode &tuningData, const ControlValue &def={})
| Parse the mode configurations from the tuning data.

## Protected Attributes
ControlInfoMap::Map | controls_
| Controls info map for the controls provided by the algorithm.
std::map< controls::AwbModeEnum, AwbAlgorithm::ModeConfig > | modes_
| Map of all configured modes.

## 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()

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

Calculate AWB data from the given statistics.

Parameters

  [in] | stats | The statistics to use for the calculation
  [in] | lux | The 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()

const ControlInfoMap::Map & libcamera::ipa::AwbAlgorithm::controls | ( |  | ) | const
| inline

Get the controls info map for this algorithm.

Returns
  The controls info map

## ◆ gainsFromColourTemperature()

virtual std::optional< RGB< double > > libcamera::ipa::AwbAlgorithm::gainsFromColourTemperature | ( | double | colourTemperature | ) |
| pure virtual

Compute white balance gains from a colour temperature.

Parameters

  [in] | colourTemperature | The 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 or std::nullopt if the conversion is not possible

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

## ◆ handleControls()

virtual void libcamera::ipa::AwbAlgorithm::handleControls | ( | const ControlList & | controls | ) |
| inline virtual

Handle the controls supplied in a request.

Parameters

  [in] | controls | The controls to handle

Reimplemented in libcamera::ipa::AwbBayes.

## ◆ init()

virtual int libcamera::ipa::AwbAlgorithm::init | ( | const ValueNode & | tuningData | ) |
| pure virtual

Initialize the algorithm with the given tuning data.

Parameters

  [in] | tuningData | The 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 ValueNode & | tuningData,
|  | const ControlValue & | def = {} )
| protected

Parse the mode configurations from the tuning data.

Parameters

  [in] | tuningData | the ValueNode representing the tuning data
  [in] | def | The 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_

std::map<controls::AwbModeEnum, AwbAlgorithm::ModeConfig> 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:

- src/ipa/libipa/awb.h
- src/ipa/libipa/awb.cpp