shariltumin / esp32-cam-micropython-2022

MicroPython esp32-cam firmware with camera support compiled with esp-idf-4.4.0. Python script files for live streaming
MIT License
174 stars 33 forks source link

Over-exposure on latest firmware (wifi+ssl) AiThinker #49

Closed davefes closed 1 month ago

davefes commented 2 months ago

Going back to 2022-12-03 seems to give the same results, ie over-exposure when outside. Tested on 2 boards and 5 cameras. Conclusion ... I have "lost the recipe".

davefes commented 1 month ago

Bought another 3 ESP32-CAM boards and 3 more cameras. With both 2024 and 2022 firmware still get over-exposure when there is say >30-50% of daylight in the picture. It feels like the automatic exposure is not working ... if there is one:

2022-12-03:

          # camera settings
            camera.pixformat(0)   # 0:JPEG, 1:Grayscale (2bytes/pixel), 2:RGB565
            camera.framesize(10)  # 1:96x96, 2:160x120, 3:176x144, 4:240x176, 5:240x240
                                  # 6:320x240, 7:400x296, 8:480x320, 9:640x480, 10:800x600
                                  # 11:1024x768, 12:1280x720, 13:1280x1024, 14:1600x1200
                                  # 15:1920x1080, 16:720x1280, 17:864x1536, 18:2048x1536
            camera.quality(5)  # [0,63] lower number means higher quality
#    camera.contrast(0)  # [-2,2] higher number higher contrast
#    camera.saturation(0)  # [-2,2] higher number higher saturation. -2 grayscale
#    camera.brightness(0)  # [-2,2] higher number higher brightness. 2 brightest
            camera.speffect(2)  # 0:,no effect 1:negative, 2:black and white, 3:reddish,
                                 # 4:greenish, 5:blue, 6:retro
#    camera.whitebalance(0)  # 0:default, 1:sunny, 2:cloudy, 3:office, 4:home
#    camera.aelevels(0)  # [-2,2] AE Level: Automatic exposure
#    camera.aecvalue(0)  # [0,1200] AEC Value: Automatic exposure control
#    camera.agcgain(0)   # [0,30] AGC Gain: Automatic Gain Control

These values worked great for the last year or so, then stopped working.

2024:

n = PIXFORMAT.get('JPEG')
s = FRAMESIZE.get('SXGA')

import camera
camera.conf(pix, n)    # set pixelformat
camera.conf(frame, s)  # set framesize

def main():
    ok = camera.init()

 # other settings after init
    camera.quality(12)
    camera.speffect(2)  # black and white

Any hints on what may have changed or what I am now doing incorrectly would be appreciated.

Thanks, Dave

davefes commented 1 month ago

See above

davefes commented 1 month ago

According to: https://github.com/raduprv/esp32-cam_ov2640-timelapse/issues/5 you are suppose to wait 3-5 seconds after init before trying to take a picture.

Will do some more testing when the sun gets up tomorrow.

davefes commented 1 month ago

The 3-5 second delay does not seem to make any difference to 2024.

Going back to 2022 with the 5 second delay I have regained the former behaviour. I originally had a 5 second delay after camera-init() but it was to allow one to break-into the program with a CTRL-C. I didn't realise that this "time delay" was doing a 2nd job.