18 static const float ae_step_default_value = 0.5f;
30 is_auto_exposure(true),
33 step(ae_step_default_value)
36 bool get_enable_auto_exposure()
const;
38 unsigned get_auto_exposure_antiflicker_rate()
const;
39 float get_auto_exposure_step()
const;
41 void set_enable_auto_exposure(
bool value);
43 void set_auto_exposure_antiflicker_rate(
unsigned value);
44 void set_auto_exposure_step(
float value);
46 static const unsigned sample_rate = 1;
47 static const unsigned skip_frames = 2;
50 bool is_auto_exposure;
59 void modify_exposure(
float& exposure_value,
bool& exp_modified,
float& gain_value,
bool& gain_modified);
62 void update_options(
const auto_exposure_state& options);
66 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; };
67 enum class rounding_mode_type { round, ceil, floor };
69 inline void im_hist(
const uint8_t* data,
const region_of_interest& image_roi,
const int rowStep,
int h[]);
70 void increase_exposure_target(
float mult,
float& target_exposure);
71 void decrease_exposure_target(
float mult,
float& target_exposure);
72 void increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
73 void decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
74 void static_increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
75 void static_decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
76 void anti_flicker_increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
77 void anti_flicker_decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
78 void hybrid_increase_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
79 void hybrid_decrease_exposure_gain(
const float& target_exposure,
const float& target_exposure0,
float& exposure,
float& gain);
81 #if defined(_WINDOWS) || defined(WIN32) || defined(WIN64) 82 inline float round(
float x) {
return std::round(x); }
84 inline float round(
float x) {
return x < 0.0 ? std::ceil(x - 0.5f) : std::floor(x + 0.5f); }
87 float exposure_to_value(
float exp_ms, rounding_mode_type rounding_mode);
88 float gain_to_value(
float gain, rounding_mode_type rounding_mode);
89 template <
typename T>
inline T sqr(
const T& x) {
return (x*x); }
90 void histogram_score(std::vector<int>& h,
const int total_weight, histogram_metric& score);
93 float minimal_exposure = 0.2f, maximal_exposure = 20.f, base_gain = 2.0f, gain_limit = 15.0f;
94 float exposure = 10.0f, gain = 2.0f, target_exposure = 0.0f;
95 uint8_t under_exposure_limit = 5, over_exposure_limit = 250;
int under_exposure_noise_limit = 50, over_exposure_noise_limit = 50;
96 int direction = 0, prev_direction = 0;
float hysteresis = 0.075f;
97 float eps = 0.01f, minimal_exposure_step = 0.01f;
98 std::atomic<float> exposure_step;
99 auto_exposure_state state;
float flicker_cycle;
bool anti_flicker_mode =
true;
101 bool is_roi_initialized =
false;
102 std::recursive_mutex state_mutex;
115 void update_auto_exposure_state(
const auto_exposure_state& auto_exposure_state);
124 : exposure(exposure), frame_counter(frame_counter)
134 static const int queue_size = 2;
138 std::shared_ptr<std::thread> _exposure_thread;
139 std::condition_variable _cv;
140 std::atomic<bool> _keep_alive;
142 std::mutex _queue_mtx;
143 std::atomic<unsigned> _frames_counter;
144 std::atomic<unsigned> _skip_frames;
exposure_and_frame_counter()
Definition: algo.h:119
auto_exposure_modes
Definition: algo.h:20
Definition: streaming.h:63
exposure_and_frame_counter(double exposure, unsigned long long frame_counter)
Definition: algo.h:123
frame_holder f_holder
Definition: algo.h:106
double exposure
Definition: algo.h:127
auto_exposure_state()
Definition: algo.h:29
unsigned long long frame_counter
Definition: algo.h:128
Definition: concurrency.h:15
callback_invocation_holder callback
Definition: algo.h:107