libcamera v0.7.2 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
libcamera::ipa::Histogram Class Reference

The base class for creating histograms. More...

## Public Member Functions
| Histogram ()
| Construct an empty Histogram.
| Histogram (Span< const uint32_t > data)
| Create a cumulative histogram.
template<typename Transform, std::enable_if_t< std::is_invocable_v< Transform, uint32_t > > * = nullptr>
| Histogram (Span< const uint32_t > data, Transform transform)
| Create a cumulative histogram.
size_t | bins () const
| Retrieve the number of bins currently used by the Histogram.
Span< const uint64_t > | data () const
| Retrieve the internal data.
uint64_t | total () const
| Retrieve the total number of values in the data set.
uint64_t | cumulativeFrequency (double bin) const
| Cumulative frequency up to a (fractional) point in a bin.
double | quantile (double q, uint32_t first=0, uint32_t last=UINT_MAX) const
| Return the (fractional) bin of the point through the histogram.
double | interQuantileMean (double lowQuantile, double hiQuantile) const
| Calculate the mean between two quantiles.

## Detailed Description

The base class for creating histograms.

This class stores a cumulative frequency histogram, which is a mapping that counts the cumulative number of observations in all of the bins up to the specified bin. It can be used to find quantiles and averages between quantiles.

## Constructor & Destructor Documentation

## ◆ Histogram() [1/3]

libcamera::ipa::Histogram::Histogram | ( |  | ) |
| inline

Construct an empty Histogram.

This empty constructor exists largely to allow Histograms to be embedded in other classes which may be created before the contents of the Histogram are known.

## ◆ Histogram() [2/3]

libcamera::ipa::Histogram::Histogram | ( | Span< const uint32_t > | data | ) |

Create a cumulative histogram.

Parameters

  [in] | data | A (non-cumulative) histogram

## ◆ Histogram() [3/3]

template<typename Transform, std::enable_if_t< std::is_invocable_v< Transform, uint32_t > > * = nullptr>

libcamera::ipa::Histogram::Histogram | ( | Span< const uint32_t > | data,
|  | Transform | transform )
| inline

Create a cumulative histogram.

Parameters

  [in] | data | A (non-cumulative) histogram
  [in] | transform | The transformation function to apply to every bin

## Member Function Documentation

## ◆ bins()

size_t libcamera::ipa::Histogram::bins | ( |  | ) | const
| inline

Retrieve the number of bins currently used by the Histogram.

Returns
  Number of bins

## ◆ cumulativeFrequency()

uint64_t libcamera::ipa::Histogram::cumulativeFrequency | ( | double | bin | ) | const

Cumulative frequency up to a (fractional) point in a bin.

Parameters

  [in] | bin | The bin up to which to cumulate

With F(p) the cumulative frequency of the histogram, the value is 0 at the bottom of the histogram, and the maximum is the number of bins. The pixels are spread evenly throughout the “bin” in which they lie, so that F(p) is a continuous (monotonically increasing) function.

Returns
  The cumulative frequency from 0 up to the specified bin

## ◆ data()

Span< const uint64_t > libcamera::ipa::Histogram::data | ( |  | ) | const
| inline

Retrieve the internal data.

Returns
  The data

## ◆ interQuantileMean()

double libcamera::ipa::Histogram::interQuantileMean | ( | double | lowQuantile,
|  | double | highQuantile ) const

Calculate the mean between two quantiles.

Parameters

  [in] | lowQuantile | low Quantile
  [in] | highQuantile | high Quantile

Quantiles are not ideal for metering as they suffer several limitations. Instead, a concept is introduced here: inter-quantile mean. It returns the mean of all pixels between lowQuantile and highQuantile.

Returns
  The mean histogram bin value between the two quantiles

## ◆ quantile()

double libcamera::ipa::Histogram::quantile | ( | double | q,
|  | uint32_t | first = 0,
|  | uint32_t | last = UINT_MAX ) const

Return the (fractional) bin of the point through the histogram.

Parameters

  [in] | q | the desired point (0 <= q <= 1)
  [in] | first | low limit (default is 0)
  [in] | last | high limit (default is UINT_MAX)

A quantile gives us the point p = Q(q) in the range such that a proportion q of the pixels lie below p. A familiar quantile is Q(0.5) which is the median of a distribution.

Returns
  The fractional bin of the point

## ◆ total()

uint64_t libcamera::ipa::Histogram::total | ( |  | ) | const
| inline

Retrieve the total number of values in the data set.

Returns
  Number of values

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

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