libcamera v0.5.1
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
awb_bayes.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2024 Ideas on Board Oy
4 *
5 * Base class for bayes AWB algorithms
6 */
7
8#pragma once
9
10#include <libcamera/controls.h>
11
14
15#include "awb.h"
16#include "interpolator.h"
17#include "pwl.h"
18
19namespace libcamera {
20
21namespace ipa {
22
23class AwbBayes : public AwbAlgorithm
24{
25public:
26 AwbBayes() = default;
27
28 int init(const YamlObject &tuningData) override;
29 AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) override;
30 std::optional<RGB<double>> gainsFromColourTemperature(double temperatureK) override;
31 void handleControls(const ControlList &controls) override;
32
33private:
34 int readPriors(const YamlObject &tuningData);
35
36 void fineSearch(double &t, double &r, double &b, ipa::Pwl const &prior,
37 const AwbStats &stats) const;
38 double coarseSearch(const ipa::Pwl &prior, const AwbStats &stats) const;
39 double interpolateQuadratic(ipa::Pwl::Point const &a,
40 ipa::Pwl::Point const &b,
41 ipa::Pwl::Point const &c) const;
42
43 Interpolator<Pwl> priors_;
44 Interpolator<Vector<double, 2>> colourGainCurve_;
45
46 ipa::Pwl ctR_;
47 ipa::Pwl ctB_;
48 ipa::Pwl ctRInverse_;
49 ipa::Pwl ctBInverse_;
50
51 double transversePos_;
52 double transverseNeg_;
53
54 ModeConfig *currentMode_ = nullptr;
55};
56
57} /* namespace ipa */
58
59} /* namespace libcamera */
Associate a list of ControlId with their values for an object.
Definition controls.h:411
A class representing the tree structure of the YAML content.
Definition yaml_parser.h:28
A base class for auto white balance algorithms.
Definition awb.h:37
const ControlInfoMap::Map & controls() const
Get the controls info map for this algorithm.
Definition awb.h:45
int init(const YamlObject &tuningData) override
Initialize the algorithm with the given tuning data.
Definition awb_bayes.cpp:146
std::optional< RGB< double > > gainsFromColourTemperature(double temperatureK) override
Compute white balance gains from a colour temperature.
Definition awb_bayes.cpp:273
AwbResult calculateAwb(const AwbStats &stats, unsigned int lux) override
Calculate AWB data from the given statistics.
Definition awb_bayes.cpp:284
void handleControls(const ControlList &controls) override
Handle the controls supplied in a request.
Definition awb_bayes.cpp:261
Class for storing, retrieving, and interpolating objects.
Definition interpolator.h:28
Describe a univariate piecewise linear function in two-dimensional real space.
Definition pwl.h:22
Vector< double, 2 > Point
Describe a point in two-dimensional real space.
Definition pwl.h:24
Framework to manage controls related to an object.
Helper class for linear interpolating a set of objects.
Base classes for AWB algorithms.
The IPA (Image Processing Algorithm) namespace.
Definition af.cpp:58
Top-level libcamera namespace.
Definition backtrace.h:17
Piecewise linear functions.
Holds the configuration of a single AWB mode.
Definition awb.h:56
The result of an AWB calculation.
Definition awb.h:23
An abstraction class wrapping hardware-specific AWB statistics.
Definition awb.h:28
Vector class.
A YAML parser helper.