libcamera v0.7.2+1-aebe4861-nvm
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 <span>
11
12#include <libcamera/controls.h>
13
16
17#include "awb.h"
18#include "interpolator.h"
19#include "pwl.h"
20
21namespace libcamera {
22
23namespace ipa {
24
26{
27public:
28 AwbBayes() = default;
29
30 int init(const ValueNode &tuningData) override;
32 calculateAwb(const AwbStats &stats, unsigned int lux,
33 std::array<double, 2> range) override;
34 std::optional<RGB<double>> gainsFromColourTemperature(double temperatureK) override;
35
36private:
37 int readPriors(const ValueNode &tuningData);
38
39 void fineSearch(double &t, double &r, double &b, ipa::Pwl const &prior,
40 const AwbStats &stats) const;
41 double coarseSearch(const ipa::Pwl &prior, const AwbStats &stats,
42 std::span<double> range) const;
43 double interpolateQuadratic(ipa::Pwl::Point const &a,
44 ipa::Pwl::Point const &b,
45 ipa::Pwl::Point const &c) const;
46
47 Interpolator<Pwl> priors_;
48 Interpolator<Vector<double, 2>> colourGainCurve_;
49
50 ipa::Pwl ctR_;
51 ipa::Pwl ctB_;
52 ipa::Pwl ctRInverse_;
53 ipa::Pwl ctBInverse_;
54
55 double transversePos_;
56 double transverseNeg_;
57};
58
59} /* namespace ipa */
60
61} /* 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:26
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.