libcamera v0.1.0+127-8e215127-dirty (2023-12-02T01:06:12+00:00)
Supporting cameras in Linux since 2019
histogram.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2/*
3 * Copyright (C) 2019, Raspberry Pi Ltd
4 *
5 * histogram.h - histogram calculation interface
6 */
7
8#pragma once
9
10#include <assert.h>
11#include <limits.h>
12#include <stdint.h>
13
14#include <vector>
15
16#include <libcamera/base/span.h>
17
18namespace libcamera {
19
20namespace ipa {
21
23{
24public:
25 Histogram(Span<const uint32_t> data);
26 size_t bins() const { return cumulative_.size() - 1; }
27 uint64_t total() const { return cumulative_[cumulative_.size() - 1]; }
28 uint64_t cumulativeFrequency(double bin) const;
29 double quantile(double q, uint32_t first = 0, uint32_t last = UINT_MAX) const;
30 double interQuantileMean(double lowQuantile, double hiQuantile) const;
31
32private:
33 std::vector<uint64_t> cumulative_;
34};
35
36} /* namespace ipa */
37
38} /* namespace libcamera */
The base class for creating histograms.
Definition: histogram.h:23
double quantile(double q, uint32_t first=0, uint32_t last=UINT_MAX) const
Return the (fractional) bin of the point through the histogram.
Definition: histogram.cpp:89
uint64_t total() const
Retrieve the total number of values in the data set.
Definition: histogram.h:27
uint64_t cumulativeFrequency(double bin) const
Cumulative frequency up to a (fractional) point in a bin.
Definition: histogram.cpp:66
size_t bins() const
Retrieve the number of bins currently used by the Histogram.
Definition: histogram.h:26
Histogram(Span< const uint32_t > data)
Create a cumulative histogram.
Definition: histogram.cpp:35
double interQuantileMean(double lowQuantile, double hiQuantile) const
Calculate the mean between two quantiles.
Definition: histogram.cpp:126
Top-level libcamera namespace.
Definition: backtrace.h:17