Ok, I promise this will be my last post. After googling for days I finally found the exact cause of my problem here: Photos with green/blue dark tint after restart? · Issue #314 · espressif/esp32-camera · GitHub.
@Stepnolab says ...
"the Automatic Exposure Control AEC and the Automatic Gain Control AGC are highly related to the calculation of the "Luminance Average" YAVG, the last being auto updated by the OV2640 and written to register 2F.
In particular, the auto-update starts immediately after a call to esp_err_t err=esp_camera_init(&config) (I use Arduino IDE)
If you start to read the register immediately after a "restart" (as in my case , using deep_sleep) it appears that the register updates every 500ms, starting from a value usually higher than the one you can get after some seconds of stabilisation.
The time to stabilize is related to the resolution (higher the resolution, longer the time) and to the luminance of the scene (stronger the brilliance, longer the time) and to the air temperature (longer the time if closer to the lower 0°C limit of operation).
During a winter cloudy day, it took from 1.2 up to 4.8 seconds to get a constant YAVG value at SVGA resolution, less than 1 second@CIF, around 6 seconds@UXGA."
I need uxga so the 6 secs is almost the delay I encountered. So now I know I can never do what I want with the ov2640.