libcamera v0.7.2+rpt20260817
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
24{
25public:
26 AwbBayes() = default;
27
28 int init(const ValueNode &tuningData) override;
30 calculateAwb(const AwbStats &stats, unsigned int lux,
31 std::array<double, 2> range) override;
32 std::optional<RGB<double>> gainsFromColourTemperature(double temperatureK) override;
33
34private:
35 int readPriors(const ValueNode &tuningData);
36
37 void fineSearch(double &t, double &r, double &b, ipa::Pwl const &prior,
38 const AwbStats &stats) const;
39 double coarseSearch(const ipa::Pwl &prior, const AwbStats &stats,
40 Span<double> range) const;
41 double interpolateQuadratic(ipa::Pwl::Point const &a,
42 ipa::Pwl::Point const &b,
43 ipa::Pwl::Point const &c) const;
44
45 Interpolator<Pwl> priors_;
46 Interpolator<Vector<double, 2>> colourGainCurve_;
47
48 ipa::Pwl ctR_;
49 ipa::Pwl ctB_;
50 ipa::Pwl ctRInverse_;
51 ipa::Pwl ctBInverse_;
52
53 double transversePos_;
54 double transverseNeg_;
55};
56
57} /* namespace ipa */
58
59} /* namespace libcamera */
A class representing a tree structure of values.
Definition value_node.h:27
Implementation of a bayesian auto white balance algorithm.
Definition awb_bayes.h:24
std::optional< RGB< double > > gainsFromColourTemperature(double temperatureK) override
Compute white balance gains from a colour temperature.
Definition awb_bayes.cpp:260
AwbImplementation::Result calculateAwb(const AwbStats &stats, unsigned int lux, std::array< double, 2 > range) override
Calculate AWB data from the given statistics.
Definition awb_bayes.cpp:272
int init(const ValueNode &tuningData) override
Initialize the algorithm by parsing tuningData.
Definition awb_bayes.cpp:143
Pure virtual base class for AWB algorithms implementations.
Definition awb.h:54
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
Framework to manage controls related to an object.
Helper class for linear interpolating a set of objects.
libipa AWB implementation
Top-level libcamera namespace.
Definition backtrace.h:17
Piecewise linear functions.
The result of an AWB computation.
Definition awb.h:56
An abstraction class wrapping hardware-specific AWB statistics.
Definition awb.h:44
Data structure to manage tree of values.
Vector class.