28 is_auto_exposure(true),
45 bool is_auto_exposure;
53 void modify_exposure(
float& exposure_value,
bool& exp_modified,
float& gain_value,
bool& gain_modified);
60 struct histogram_metric {
int under_exposure_count;
int over_exposure_count;
int shadow_limit;
int highlight_limit;
int lower_q;
int upper_q;
float main_mean;
float main_std; };
61 enum class rounding_mode_type { round, ceil, floor };
63 inline void im_hist(
const uint8_t* data,
const region_of_interest& image_roi,
const int rowStep,
int h[]);
64 void increase_exposure_target(
float mult,
float& target_exposure);
65 void decrease_exposure_target(
float mult,
float& target_exposure);
66 void increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
67 void decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
68 void static_increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
69 void static_decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
70 void anti_flicker_increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
71 void anti_flicker_decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
72 void hybrid_increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
73 void hybrid_decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
75 #if defined(_WINDOWS) || defined(WIN32) || defined(WIN64) 76 inline float round(
float x) {
return std::round(x); }
78 inline float round(
float x) {
return x < 0.0 ? std::ceil(x - 0.5f) : std::floor(x + 0.5f); }
81 float exposure_to_value(
float exp_ms, rounding_mode_type rounding_mode);
82 float gain_to_value(
float gain, rounding_mode_type rounding_mode);
83 template <
typename T>
inline T sqr(
const T& x) {
return (x*x); }
84 void histogram_score(std::vector<int>& h,
const int total_weight, histogram_metric& score);
87 float minimal_exposure = 0.2f, maximal_exposure = 20.f, base_gain = 2.0f, gain_limit = 15.0f;
88 float exposure = 10.0f, gain = 2.0f, target_exposure = 0.0f;
89 uint8_t under_exposure_limit = 5, over_exposure_limit = 250;
int under_exposure_noise_limit = 50, over_exposure_noise_limit = 50;
90 int direction = 0, prev_direction = 0;
float hysteresis = 0.075f;
91 float eps = 0.01f, exposure_step = 0.1f, minimal_exposure_step = 0.01f;
94 bool is_roi_initialized =
false;
95 std::recursive_mutex state_mutex;
127 static const int queue_size = 2;
131 std::shared_ptr<std::thread> _exposure_thread;
132 std::condition_variable _cv;
133 std::atomic<bool> _keep_alive;
135 std::mutex _queue_mtx;
136 std::atomic<unsigned> _frames_counter;
137 std::atomic<unsigned> _skip_frames;
void add_frame(frame_holder frame, callback_invocation_holder callback)
~auto_exposure_mechanism()
exposure_and_frame_counter()
Definition: algo.h:112
static const unsigned skip_frames
Definition: algo.h:42
void update_roi(const region_of_interest &ae_roi)
void update_auto_exposure_state(const auto_exposure_state &auto_exposure_state)
auto_exposure_modes
Definition: algo.h:18
Definition: streaming.h:63
unsigned get_auto_exposure_antiflicker_rate() const
void modify_exposure(float &exposure_value, bool &exp_modified, float &gain_value, bool &gain_modified)
auto_exposure_modes get_auto_exposure_mode() const
exposure_and_frame_counter(double exposure, unsigned long long frame_counter)
Definition: algo.h:116
void set_auto_exposure_antiflicker_rate(unsigned value)
auto_exposure_algorithm(const auto_exposure_state &auto_exposure_state)
void update_auto_exposure_roi(const region_of_interest &roi)
frame_holder f_holder
Definition: algo.h:99
double exposure
Definition: algo.h:120
bool analyze_image(const frame_interface *image)
auto_exposure_state()
Definition: algo.h:27
void set_auto_exposure_mode(auto_exposure_modes value)
unsigned long long frame_counter
Definition: algo.h:121
void update_options(const auto_exposure_state &options)
Definition: concurrency.h:15
void set_enable_auto_exposure(bool value)
callback_invocation_holder callback
Definition: algo.h:100
static const unsigned sample_rate
Definition: algo.h:41
bool get_enable_auto_exposure() const
auto_exposure_mechanism(option &gain_option, option &exposure_option, const auto_exposure_state &auto_exposure_state)