problem with settings on esp32-cam module

alanesq
Posts: 86
Joined: Thu Dec 14, 2017 8:38 pm

problem with settings on esp32-cam module

Postby alanesq » Sat Feb 22, 2020 6:50 pm

I am having real problems trying to configure the settings on my esp32-cam modules (using the ov2640 camera).
I seem to only be able to set/adjust one of the settings, if I try to adjust two or more it stops adjusting most / any of them? I have tried everything I can possibly think of but to no avail...

i.e. if i use the commands:
sensor_t *s = esp_camera_sensor_get();
s->set_brightness(s, 2);
This works fine, but if I add this line
s->set_contrast(s, 0);
Then the brightness no longer changes no matter what setting I give it. This is the case with most of the other settings too, if I try to set three then pretty much none of them will have any effect.

You can view my full code here: https://github.com/alanesq/CameraWifiMotion
the settings are in motion.h

Anyone had this problem or have any idea what I am doing wrong?
Thanks in advance...

alanesq
Posts: 86
Joined: Thu Dec 14, 2017 8:38 pm

Re: problem with settings on esp32-cam module

Postby alanesq » Mon Feb 24, 2020 11:53 am

Basically what I am asking is, why does this work?

sensor_t *s = esp_camera_sensor_get();
s->set_brightness(s, 0);
fb = esp_camera_fb_get();


but this stops both brightness and contrast adjustment working at all:

sensor_t *s = esp_camera_sensor_get();
s->set_brightness(s, 0);
s->set_contrast(s, 0);
fb = esp_camera_fb_get();

Am I missing something???

alanesq
Posts: 86
Joined: Thu Dec 14, 2017 8:38 pm

Re: problem with settings on esp32-cam module

Postby alanesq » Fri Feb 28, 2020 5:32 pm

In case anyone else has this problem I have had a bit of a breakthrough.
I think my problems all along is the camera has auto gain and exposure which I am fighting when I try to make adjustments to the image. It is not very clear what many of the settings actually are/do but I now have it working using the following:

s->set_gain_ctrl(s, 0); // auto gain off (1 or 0)
s->set_exposure_ctrl(s, 0); // auto exposure off (1 or 0)
s->set_agc_gain(s, 0); // set gain manually (0 - 30)
s->set_aec_value(s, 600); // set exposure manually (0-1200)

other settings as far as I can figure out are:
// s->set_brightness(s, 0); // (-2 to 2) - set brightness
// s->set_awb_gain(s, 0); // Auto White Balance?
// s->set_lenc(s, 0); // lens correction? (1 or 0)
// s->set_raw_gma(s, 1); // (1 or 0)?
// s->set_quality(s, 10); // (0 - 63)
// s->set_whitebal(s, 1); // white balance
// s->set_wb_mode(s, 1); // white balance mode (0 to 4)
// s->set_aec2(s, 0); // automatic exposure sensor? (0 or 1)
// s->set_aec_value(s, 0); // automatic exposure correction? (0-1200)
// s->set_saturation(s, 0); // (-2 to 2)
// s->set_hmirror(s, 0); // (0 or 1) flip horizontally
// s->set_gainceiling(s, GAINCEILING_32X); // Image gain (GAINCEILING_x2, x4, x8, x16, x32, x64 or x128)
// s->set_contrast(s, 0); // (-2 to 2)
// s->set_sharpness(s, 0); // (-2 to 2)
// s->set_colorbar(s, 0); // (0 or 1) - testcard
// s->set_special_effect(s, 0);
// s->set_ae_level(s, 0); // auto exposure levels (-2 to 2)
// s->set_bpc(s, 0); // black pixel correction
// s->set_wpc(s, 0); // white pixel correction
// s->set_dcw(s, 1); // downsize enable? (1 or 0)?

mosazahany@gmail.com
Posts: 2
Joined: Tue Jan 18, 2022 4:43 pm

Re: problem with settings on esp32-cam module

Postby mosazahany@gmail.com » Wed Mar 02, 2022 10:56 pm

i solved this problem

mosazahany@gmail.com
Posts: 2
Joined: Tue Jan 18, 2022 4:43 pm

Re: problem with settings on esp32-cam module

Postby mosazahany@gmail.com » Thu Mar 03, 2022 8:00 am

Strange problems in adjusting the saturationand the brightness in ov2640
These bugs do not actually exist and are a problem of the available documents
When you execute the following commands
set_brightness(s,2);
set_contrast(s,2);
set_brightness(s,2);
The last command is always active and the previous commands are canceled.
To solve this problem, you must activate the desired effect and this is done with the following command

Run the following command at the end of all settings.

unsigned char enable_effect= 1(saturation and hue enable)+
2(aditional saturation enable)+
4(brighnes and contrast enable)+
8(spital effect1 enable green -> blue)+
16(spital effect1 enable gray -> read)+
32(remove (UV) in YUV color system)+
64(enable negative effect)+
128(remove (Y) in YUV color system) ;
write_SCCB(0xff, 0x00);
write_SCCB(0x7c, 0x00);
write_SCCB(0x7d,enable_effect);

command
write_SCCB(0x7c, ADRESS);
Preparing the address for data injection

ofter that use
The following command to inject data
write_SCCB(0x7d,byte_0);
write_SCCB(0x7d,byte_1);
write_SCCB(0x7d,byte_2);
.
.
.

The memory structure is as follows
byte_0 =enable_effect
byte_0->bit0 =saturation and hue
byte_0->bit1 =saturation enable
byte_0->bit2 =brighnes and contrast enable
byte_0->bit3 =green -> blue spitial effect (Antique and blunish and greenish and readdish and b&w) enable
byte_0->bit4 =gray -> read spitial effect (Antique and blunish and greenish and readdish and b&w) enable
byte_0->bit5 =remove (UV) in YUV color system
byte_0->bit6 =negative enable
byte_0->bit7 =remove (Y) in YUV color system
byte_1 =saturation1 0-255
byte_2 =hue 0-255
byte_3 =saturation2 0-255
byte_4 =reenter saturation2 in documents
byte_5 =spital effect green -> blue 0-255
byte_6 =spital effect gray -> read 0-255
byte_7 =contrast uper eadge 0-255
byte_8 =contrast lower eadge 0-255
byte_9 =brighnes 0-255
byte_10= if byte_10==4 contrast effective

mosazahany@gmail.com

با تشکر

tchalabi
Posts: 3
Joined: Sat Jun 19, 2021 9:43 pm

Re: problem with settings on esp32-cam module

Postby tchalabi » Thu Jun 02, 2022 4:12 am

Sir (mosazahany@gmail.com)

Thank you for solving this problem.
I do not understand how to integrate your code into my software to fix the problem.

I'm using and ESP32 w/ the Arduino IDE, OV2640 and standard ESP32 Camera software as posted on RandomNerds.com

Can you please post the actual code so I may copy/paste into my code.
Also, into what file (and what location) do I place the code.


Thank you so much!

Who is online

Users browsing this forum: No registered users and 78 guests