python picture tweaking

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
KJM
Posts: 158
Joined: Sun Nov 18, 2018 10:53 pm
Location: Sydney AU

python picture tweaking

Post by KJM » Sat Jun 11, 2022 12:55 am

The upython set of knobs for twiddling camera settings on the ESP32
camera.saturation(int value) image saturation from -2 to 2 (0 default)
camera.brightness(int value) image brightness from -2 to 2 (0 default)
camera.contrast(int value) image contrast from -2 to 2 (0 default)
camera.quality(int value) image quality from 10 (high) to 63 (low)
camera.flip(int value) vertical flip 0 or 1
camera.mirror(int value) horizontal flip 0 or 1
camera.framesize(int value) image size FRAME_96X96 FRAME_QQVGA FRAME_QCIF
FRAME_HQVGA FRAME_240X240 FRAME_QVGA
FRAME_CIF FRAME_HVGA FRAME_VGA
FRAME_SVGA FRAME_XGA FRAME_HD
FRAME_SXGA FRAME_UXGA FRAME_FHD
FRAME_P_HD FRAME_P_3MP FRAME_QXGA
FRAME_QHD FRAME_WQXGA FRAME_P_FHD FRAME_QSXGA
camera.speffect(int value) color effects for the image EFFECT_NONE (default) EFFECT_NEG EFFECT_BW
EFFECT_RED EFFECT_GREEN EFFECT_BLUE EFFECT_RETRO
camera.whitebalance(int value) white balance WB_NONE (default) WB_SUNNY WB_CLOUDY
WB_OFFICE WB_HOME

seems to be a subset of those available in C
s->set_brightness(s, 0); // -2 to 2
s->set_contrast(s, 0); // -2 to 2
s->set_saturation(s, 0); // -2 to 2
s->set_special_effect(s, 0); // 0 to 6 (0 - No Effect, 1 - Negative, 2 - Grayscale, 3 - Red Tint, 4 - Green Tint, 5 - Blue Tint, 6 - Sepia)
s->set_whitebal(s, 1); // 0 = disable , 1 = enable
s->set_awb_gain(s, 1); // 0 = disable , 1 = enable
s->set_wb_mode(s, 0); // 0 to 4 - if awb_gain enabled (0 - Auto, 1 - Sunny, 2 - Cloudy, 3 - Office, 4 - Home)
s->set_exposure_ctrl(s, 1); // 0 = disable , 1 = enable
s->set_aec2(s, 0); // 0 = disable , 1 = enable
s->set_ae_level(s, 0); // -2 to 2
s->set_aec_value(s, 300); // 0 to 1200
s->set_gain_ctrl(s, 1); // 0 = disable , 1 = enable
s->set_agc_gain(s, 0); // 0 to 30
s->set_gainceiling(s, (gainceiling_t)0); // 0 to 6
s->set_bpc(s, 0); // 0 = disable , 1 = enable
s->set_wpc(s, 1); // 0 = disable , 1 = enable
s->set_raw_gma(s, 1); // 0 = disable , 1 = enable
s->set_lenc(s, 1); // 0 = disable , 1 = enable
s->set_hmirror(s, 0); // 0 = disable , 1 = enable
s->set_vflip(s, 0); // 0 = disable , 1 = enable
s->set_dcw(s, 1); // 0 = disable , 1 = enable
s->set_colorbar(s, 0); // 0 = disable , 1 = enable

The critical missing adjustment in upython is the exposure control. Does anybody know of a way to enable exposure control in upython on an ESP32 CAM board?

tepalia02
Posts: 99
Joined: Mon Mar 21, 2022 5:13 am

Re: python picture tweaking

Post by tepalia02 » Mon Jul 18, 2022 4:44 am

Could not find anything about the exposure control in micropython. The only command I could find is set_exposure_ctrl(s, 1); Isn't there any command in micropython? Has anybody found anything?

KJM
Posts: 158
Joined: Sun Nov 18, 2018 10:53 pm
Location: Sydney AU

Re: python picture tweaking

Post by KJM » Mon Jul 18, 2022 5:13 am

For stills, exposure (especially outdoors) improves if you take 10 frames & use only the last one.

Post Reply