-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I've been experimenting with the ov2640 sensor and found some nice things #203
Comments
Longer exposure. This one is easy: And finally, being able to save high quality images (if the image is getting corrupted) Another interesting discovery is that this DSP register changes the quality of the image. Only the first 7 bits matter, not sure what the 8th bit is used for. very low numbers will give you very bad quality, but at higher numbers I couldn't find any noticable differences in quality. s->set_reg(s,0xff,0xff,0x00);//banksel |
And here are my complete settings for best quality picture (YMMV, feel free to experiment) s->set_brightness(s, 0); // -2 to 2 change_sharpness(0);
delay(1200); |
I'm super excited to try these modifications. As for your post, I was wondering if you could fix the formatting for easier viewing? Thanks! |
Unfortunately, I can't edit posts with my browser (Waterfox). Either way, I just wanted to post the information, hoping that others find it useful and maybe some of it ends up in the official version, if the developers think it's useful. |
so far I think this both drastically improved my quality and solved my buffer issues. Thank you so much! I'll be testing more this week and post some nicely formatted code. |
@raduprv , Thanks a lot for sharing the results of your big investigation! I can confirm your settings in this post #203 (comment) works well for me also. I have a ESP32CAM AI thinker type with a OV2640 sensor and 4MB psram. I have two questions that I hope you have time to answer. Maybe they can also be of interest to others. Can you elaborate a bit on how to change exposure time?
But I did not get darker images by changing frame rate 01->02 What is the link between the value 1 in camera config:
and the value 1 in your solution
which one takes precedence? Would putting a 5 in your solution increase quality? |
Hi. Setting the config.jpeg_quality = 1; at the beginning tells the camera library to allocate a large buffer (if quality is under 4). The second part is the actual quality. For your other questions, take a look at my timelapse program here: https://github.com/raduprv/esp32-cam_ov2640-timelapse I set the exposure based on the lightmeter register. I do it by empirically observing which is the best value depending on the value of that register. |
@raduprv: Thank you for providing the code, which has been very helpful in getting a decent image quality from the camera. Have you been able to find out anything about the noise reduction also? |
Check out my timelapase program, it has all the settings that I know of: And yes, I looked at all the files I could find for that camera :) |
This issue appears to be stale. Please close it if its no longer valid. |
First, use this code, it has the set_reg() actually implemented: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
Most of my changes only make sense if you want to capture still pictures. For video, the default settings are more or less ok.
So, I identified a few problems with the default settings:
So here are the solutions. Btw, one problem with capturing still images is that after changing the sensor settings you must use a small delay (over 1 second for longer exposures) before getting the frame buffer.
typedef unsigned char u8;
#define OV2640_MAXLEVEL_SHARPNESS 6
const static u8 OV2640_SHARPNESS_AUTO[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0x20, 0x20,
0x00, 0x00, 0x00
};
const static u8 OV2640_SHARPNESS_MANUAL[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0x00, 0x20,
0x00, 0x00, 0x00
};
const static u8 OV2640_SHARPNESS_LEVEL0[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xc0, 0x1f,
0x00, 0x00, 0x00
};
const static u8 OV2640_SHARPNESS_LEVEL1[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xc1, 0x1f,
0x00, 0x00, 0x00
};
const static u8 OV2640_SHARPNESS_LEVEL2[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xc2, 0x1f,
0x00, 0x00, 0x00
};
const static u8 OV2640_SHARPNESS_LEVEL3[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xc4, 0x1f,
0x00, 0x00, 0x00
};
const static u8 OV2640_SHARPNESS_LEVEL4[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xc8, 0x1f,
0x00, 0x00, 0x00
};
const static u8 OV2640_SHARPNESS_LEVEL5[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xd0, 0x1f,
0x00, 0x00, 0x00
};
const static u8 OV2640_SHARPNESS_LEVEL6[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xdf, 0x1f,
0x00, 0x00, 0x00
};
const static u8 *OV_SETTING_SHARPNESS[]=
{
OV2640_SHARPNESS_LEVEL0,
OV2640_SHARPNESS_LEVEL1,
OV2640_SHARPNESS_LEVEL2,
OV2640_SHARPNESS_LEVEL3,
OV2640_SHARPNESS_LEVEL4,
OV2640_SHARPNESS_LEVEL5,
OV2640_SHARPNESS_LEVEL6
};
static int table_mask_write(const u8* ptab)
{
u8 address;
u8 value,orgval;
u8 mask;
const u8 *pdata=ptab;
sensor_t * s = esp_camera_sensor_get();
}
int change_sharpness( int sharpness )
{
if ( sharpness > OV2640_MAXLEVEL_SHARPNESS)
{
return -1;
}
}
After you initialize the camera, simply call: change_sharpness(0);
The text was updated successfully, but these errors were encountered: