Loading [MathJax]/extensions/tex2jax.js
Monado OpenXR Runtime
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
u_autoexpgain.h
Go to the documentation of this file.
1// Copyright 2022, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Automatically compute exposure and gain values from an image stream
6 * @author Mateo de Mayo <mateo.demayo@collabora.com>
7 * @ingroup aux_util
8 */
9
10#pragma once
11
12#include "xrt/xrt_frame.h"
13#include <stdint.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19//! An auto exposure/gain strategy tunes the algorithm for specific objectives.
21{
22 U_AEG_STRATEGY_TRACKING = 0, //!< Lower exposure and gain at the cost of darker images.
23 U_AEG_STRATEGY_DYNAMIC_RANGE, //!< Tries to maximize the image information
24 U_AEG_STRATEGY_COUNT
25};
26
27struct u_autoexpgain;
28
29/*!
30 * Create auto exposure and gain (AEG) algorithm object.
31 *
32 * @param strategy What objective is preferred for the algorithm.
33 * @param enabled_from_start Update exposure/gain from the start.
34 * @param frame_delay About how many frames does it take for exp and gain to settle in.
35 * @return struct u_autoexpgain* Created object
36 */
37struct u_autoexpgain *
38u_autoexpgain_create(enum u_aeg_strategy strategy, bool enabled_from_start, int frame_delay);
39
40//! Setup UI for the AEG algorithm
41void
42u_autoexpgain_add_vars(struct u_autoexpgain *aeg, void *root, char *prefix);
43
44//! Update the AEG with a frame
45void
46u_autoexpgain_update(struct u_autoexpgain *aeg, struct xrt_frame *xf);
47
48//! Get currently computed exposure value in usecs.
49float
51
52//! Get currently computed gain value in the [0, 255] range.
53float
55
56//! Destroy AEG object
57void
59
60#ifdef __cplusplus
61}
62#endif
Auto exposure and gain (AEG) adjustment algorithm state.
Definition: u_autoexpgain.c:67
enum u_aeg_strategy strategy
The selected strategy affects various targets of the algorithm.
Definition: u_autoexpgain.c:85
int frame_delay
A camera might take a couple of frames until the new exposure/gain sets in the image.
Definition: u_autoexpgain.c:111
Basic frame data structure - holds a pointer to buffer.
Definition: xrt_frame.h:25
u_aeg_strategy
An auto exposure/gain strategy tunes the algorithm for specific objectives.
Definition: u_autoexpgain.h:21
@ U_AEG_STRATEGY_TRACKING
Lower exposure and gain at the cost of darker images.
Definition: u_autoexpgain.h:22
@ U_AEG_STRATEGY_DYNAMIC_RANGE
Tries to maximize the image information.
Definition: u_autoexpgain.h:23
float u_autoexpgain_get_exposure(struct u_autoexpgain *aeg)
Get currently computed exposure value in usecs.
Definition: u_autoexpgain.c:502
void u_autoexpgain_add_vars(struct u_autoexpgain *aeg, void *root, char *prefix)
Setup UI for the AEG algorithm.
Definition: u_autoexpgain.c:457
float u_autoexpgain_get_gain(struct u_autoexpgain *aeg)
Get currently computed gain value in the [0, 255] range.
Definition: u_autoexpgain.c:508
void u_autoexpgain_destroy(struct u_autoexpgain **aeg)
Destroy AEG object.
Definition: u_autoexpgain.c:514
struct u_autoexpgain * u_autoexpgain_create(enum u_aeg_strategy strategy, bool enabled_from_start, int frame_delay)
Create auto exposure and gain (AEG) algorithm object.
Definition: u_autoexpgain.c:424
void u_autoexpgain_update(struct u_autoexpgain *aeg, struct xrt_frame *xf)
Update the AEG with a frame.
Definition: u_autoexpgain.c:495
Data frame header.