raduprv / esp32-cam_ov2640-timelapse

A timelapse program for esp32 cam with ov2640 sensor. The exposure is done manually based on the light level, and the image quality is far better than the default settings.
Apache License 2.0
37 stars 5 forks source link

Could someone fix the over exposed light issue? #5

Open guilhae opened 3 years ago

guilhae commented 3 years ago

I know the author already wrote about this, but i would really like that the light works well. Im new at this, and i could not find any program that just works fine. If someone know any program that do the same and without web interface, or could fix this issue i would apreciate it.

FBMinis commented 2 years ago

Suggestion: use and external RTC like the DS3231 and if it's daylight time, setup the camera normally; if it's nighttime config the camera with raduprv's registers.

raduprv commented 2 years ago

Setting the camera 'normally' will not work. You will still get an overexposed image.

FBMinis commented 2 years ago

Ok, I thought it would be possible to capture a frame before s->set_reg(s,0xff,0xff,0x01);//banksel , that is, without modifying playing with the registers.

raduprv commented 2 years ago

You can, but did you try doing that in a bright day outside?

FBMinis commented 2 years ago

With your code I have not tried to take photos without modifying the registers, but with other codes that dont modify them I have not had problems of overexposure:

https://www.youtube.com/watch?v=SVOAQU2L5ow

raduprv commented 2 years ago

Well, my program is based on one of the sample programs, the one with the web streaming. And there it is also overexposed in bright daylight. Can you show me the program you used to take the timelapse with?

FBMinis commented 2 years ago

I dont know if you remember me but we discussed this some months ago during the quarentine:

https://github.com/FBMinis/DS3231-Alarm-ESP32-Cam-Telegram-Bot

It is essential to wait some seconds between camera config and frame capture, otherwise the photos are overexposed or with weird colors. You can see in my project that I config the camera and then connect to wifi, which gives enough time for the sensor to settle.

Here are some photos showing what happens:

https://github.com/cotestatnt/AsyncTelegram2/issues/23#issuecomment-930389447

raduprv commented 2 years ago

Yes, I remember that we talked before. But at that time you haven't fixed the issue, so I didn't know you had a solution to that. That's good to know, thanks! I will take a look at it when I have some time. Although in my case it is not ideal to wait, because it just wastes the battery. But will take a look at it anyway :)

FBMinis commented 2 years ago

Cool, good luck with your tests! I suggest 5 seconds between camera init and fb capture because that's a little over the time it take for wifi to connect. My project takes about 10 seconds to power up and send a photo to telegram/shut down.

guilhae commented 2 years ago

So, i tried to make my own code based on this and others, and it kinda works. The exposure works, and its done automatic like FBMinis said, i just set a 3 seconds delay between camera init and the fb capture. But sometimes the code just stops and i dont know why... the led light just keeps kinda on. So i would apreciate help :)

FBMinis commented 2 years ago

Can you link your code, please?

We know that the big LED is connected to the sdcard lines. Since I dont need the LED, I lift one leg of the transistor to disable it.

https://randomnerdtutorials.com/esp32-cam-ai-thinker-pinout/

Check this code which shows how to have more control over the LED while still using the SDCard:

https://github.com/cotestatnt/AsyncTelegram2/tree/main/examples/ESP32/ESP32-CAM-PIR

FBMinis commented 2 years ago

So, i tried to make my own code based on this and others, and it kinda works. The exposure works, and its done automatic like FBMinis said, i just set a 3 seconds delay between camera init and the fb capture. But sometimes the code just stops and i dont know why... the led light just keeps kinda on. So i would apreciate help :)

There is some info here you might find useful:

https://github.com/espressif/esp32-camera/issues/203

Normal exposure vs Radu's code (in this case I used frame size XGA and image quality 10 because I dont need high quality images) asynctelegram2esp32camphotoonpoweron photo_2021-10-18_22-57-57 esp32-cam_ov2640-timelapse

FBMinis commented 1 year ago

This topic has ben receiving some attention here: https://github.com/jameszah/ESP32-CAM-Video-Telegram/discussions/27