ESP32 CAM White Balancing

charlieyang
Posts: 2
Joined: Mon Dec 09, 2019 12:04 pm

ESP32 CAM White Balancing

Postby charlieyang » Mon Dec 09, 2019 12:10 pm

Hi all,
I was debugging my image capturing program recently. My problem is when I configured the sensor with all default settings except the resolution. So the initialization code is:

sensor_t * s = esp_camera_sensor_get();
s->set_framesize(s, FRAMESIZE_SXGA);

And the image becomes like this:
ESP-00003_1575890626_{w1_c0_f0}.jpg
ESP-00003_1575890626_{w1_c0_f0}.jpg (69.35 KiB) Viewed 4125 times
The image's color is quite yellow.
It was clear that the problem is related to white balance.
So I turned on automatic white balance with following code:

s->set_whitebal(s, 1);
s->set_awb_gain(s, 1);
s->set_wb_mode(s, 0);

But there is nothing changed to the image.

I exported the sensor status to a JSON:
{
"framesize":9,
"quality":10,
"brightness":0,
"contrast":0,
"saturation":0,
"sharpness":0,
"special_effect":0,
"wb_mode":0,
"awb":1,
"awb_gain":1,
"aec":1,
"aec2":0,
"ae_level":0,
"aec_value":168,
"agc":1,
"agc_gain":0,
"gainceiling":0,
"bpc":0,
"wpc":1,
"raw_gma":1,
"lenc":1,
"vflip":0,
"hmirror":0,
"dcw":1,
"colorbar":0,
}

The I referred to the official example of WebCamServer:
I changed the resolution on the index page and press "Get Still", then the image seems quite satisfying. The color becomes normal.
ESP-00003_1575890626_{w1_c0_f0}.jpg
ESP-00003_1575890626_{w1_c0_f0}.jpg (69.35 KiB) Viewed 4125 times
Then I exported the sensor status by grabbing the response of the http://xxx.xxx.xxx.xxx/control, which is also a json:

{
"aec":1,
"aec2":0,
"ae_level":0,
"aec_value":168,
"agc":1,
"agc_gain":0,
"awb":1,
"awb_gain":1,
"brightness":0,
"bpc":0,
"wpc":1,
"contrast":0,
"gainceiling":0,
"lenc":1,
"vflip":0,
"hmirror":0,
"dcw":1,
"colorbar":0,
"framesize":9,
"quality":10,
"raw_gma":1,
"saturation":0,
"sharpness":0,
"special_effect":0,
"wb_mode":0,
}

This is just the same as what was exported in my own script.
Things get extremely weirded, why is automatic white balancing not activated in my own program. Did I miss some other configuration?
Attachments
capture.jpg
capture.jpg (44.7 KiB) Viewed 4125 times

serhiyd
Posts: 1
Joined: Mon Jan 18, 2021 3:59 pm

Re: ESP32 CAM White Balancing

Postby serhiyd » Mon Jan 18, 2021 4:05 pm

it takes time for the sensor to do white balancing (up to 5 seconds in my case)

Who is online

Users browsing this forum: No registered users and 59 guests