|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
32 #define MAX_HIST_Y 255
35 #ifndef BEBOP_AE_AWB_VERBOSE
36 #define BEBOP_AE_AWB_VERBOSE 0
40 #define PRINT(string,...) fprintf(stderr, "[bebop_ae_awb->%s()] " string,__FUNCTION__ , ##__VA_ARGS__)
42 #if BEBOP_AE_AWB_VERBOSE
44 #define VERBOSE_PRINT PRINT
46 #define VERBOSE_PRINT(...)
50 #ifndef BEBOP_AE_AWB_NICE
51 #define BEBOP_AE_AWB_NICE 5
54 #ifndef BEBOP_AUTO_EXPOSURE
55 #define BEBOP_AUTO_EXPOSURE true
59 #ifndef BEBOP_AE_EXPOSURE_GAIN
60 #define BEBOP_AE_EXPOSURE_GAIN 0.8
65 #ifndef BEBOP_AE_MIDDLE_INDEX
66 #define BEBOP_AE_MIDDLE_INDEX 160
71 #ifndef BEBOP_AE_DARK_IGNORE
72 #define BEBOP_AE_DARK_IGNORE 0.4
77 #ifndef BEBOP_AE_BRIGHT_IGNORE
78 #define BEBOP_AE_BRIGHT_IGNORE 0.2
83 #ifndef BEBOP_AE_DARK_BINS
84 #define BEBOP_AE_DARK_BINS 80
89 #ifndef BEBOP_AE_BRIGHT_BINS
90 #define BEBOP_AE_BRIGHT_BINS 20
94 #ifndef BEBOP_AUTO_WHITE_BALANCE
95 #define BEBOP_AUTO_WHITE_BALANCE true
99 #ifndef BEBOP_AWB_MIN_GAINS
100 #define BEBOP_AWB_MIN_GAINS 1.0
102 PRINT_CONFIG_VAR(BEBOP_AE_MIN_GAINS)
105 #ifndef BEBOP_AWB_MAX_GAINS
106 #define BEBOP_AWB_MAX_GAINS 63.5
111 #ifndef BEBOP_AWB_GAIN
112 #define BEBOP_AWB_GAIN 0.5
117 #ifndef BEBOP_AWB_GAIN_SCHEDULING
118 #define BEBOP_AWB_GAIN_SCHEDULING false
123 #ifndef BEBOP_AWB_GAIN_SCHEDULING_TARGET
124 #define BEBOP_AWB_GAIN_SCHEDULING_TARGET 10.0
129 #ifndef BEBOP_AWB_GAIN_SCHEDULING_TOLERANCE
130 #define BEBOP_AWB_GAIN_SCHEDULING_TOLERANCE 7.5
135 #ifndef BEBOP_AWB_GAIN_SCHEDULING_STEP
136 #define BEBOP_AWB_GAIN_SCHEDULING_STEP 0.02
141 #ifndef BEBOP_AWB_MIN_GREY_PIXELS
142 #define BEBOP_AWB_MIN_GREY_PIXELS 1000
156 float dt = (img->pprz_ts - prev_time) * 1e-6
f;
158 prev_time = img->pprz_ts;
175 static float prev_real_exposure = 0.f;
176 static uint8_t prev_exposure_stuck = 0;
192 if (bright_index < MIN_HIST_Y || bright_index >
MAX_HIST_Y) {
193 bright_index = dark_index;
198 cdf[bright_index - 1] - cdf[dark_index] +
205 while (current_pixels < median_pixels && ae_current_ind <
MAX_HIST_Y) {
207 if (ae_current_ind <= dark_index) {
210 }
else if (ae_current_ind >= bright_index) {
219 float ae_current_level = (float)ae_current_ind;
222 ae_current_level -= (current_pixels - median_pixels) / (
float)yuv_stats.
ae_histogram_Y[ae_current_ind];
231 float adjustment = 1.f;
232 if (ae_current_level > 1e-5) {
234 Bound(adjustment, 1 / 16.
f, 16.
f);
244 prev_exposure_stuck++;
253 prev_exposure_stuck = 0;
void mt9f002_reset_color(struct mt9f002_t *mt)
float target_exposure
Target exposure time in ms.
int isp_get_statistics_yuv(struct isp_yuv_stats_t *yuv_stats)
#define BEBOP_AWB_MIN_GREY_PIXELS
float gain_scheduling_tolerance
#define BEBOP_AE_DARK_BINS
void mt9f002_set_exposure(struct mt9f002_t *mt)
Set the exposure configuration Depends on the blanking (and therefore the FPS)
struct awb_setting_t awb_set
struct video_listener * cv_add_to_device_async(struct video_config_t *device, cv_function func, int nice_level, uint16_t fps, uint8_t id)
#define BEBOP_AUTO_WHITE_BALANCE
uint32_t awb_nb_grey_pixels
float gain_scheduling_step
#define BEBOP_AE_EXPOSURE_GAIN
float gain_blue
Gain for the Blue pixels [1., 63.50].
#define BEBOP_AE_BRIGHT_BINS
void mt9f002_set_gains(struct mt9f002_t *mt)
Sets the GreenR, Blue, Red and GreenB gains.
#define BEBOP_AE_AWB_NICE
#define BEBOP_AUTO_EXPOSURE
#define BEBOP_AWB_GAIN_SCHEDULING
#define BEBOP_AE_MIDDLE_INDEX
#define BEBOP_AWB_GAIN_SCHEDULING_TOLERANCE
uint16_t f
Camera baseline, in meters (i.e. horizontal distance between the two cameras of the stereo setup)
struct ae_setting_t ae_set
float gain_green1
Gain for the GreenR pixels [1., 63.50].
#define BEBOP_AWB_MIN_GAINS
#define BEBOP_AWB_GAIN_SCHEDULING_STEP
float gain_green2
Gain for the GreenB pixels [1., 63.50].
float real_exposure
Real exposure time in ms.
float gain_red
Gain for the Red pixels [1., 63.50].
#define BEBOP_AWB_MAX_GAINS
#define VERBOSE_PRINT(...)
#define BEBOP_AE_AWB_VERBOSE
void bebop_ae_awb_init(void)
#define BEBOP_AE_DARK_IGNORE
void mt9f002_reset_exposure(struct mt9f002_t *mt)
uint32_t ae_histogram_Y[256]
#define BEBOP_AE_BRIGHT_IGNORE
static struct image_t * update_ae_awb(struct image_t *img, uint8_t camera_id)
#define BEBOP_AWB_GAIN_SCHEDULING_TARGET
float gain_scheduling_target