Closed skylli closed 12 months ago
you can try to lower the XCLK, since 20MHz might be a bit too fast for the esp to be able to process all data from the sensor. High resolutions are generally much more possible with JPEG mode sensors. We have success grabbing a 5MP images with JPEG.
I have been experiencing continuous "cam_hal: EV-EOF-OVF" errors, and I am unable to capture images even when I reduce XCLK.
.xclk_freq_hz = 18000000,//CONFIG_XCLK_FREQ,
.ledc_timer = LEDC_TIMER_0, // This is only valid on ESP32/ESP32-S2. ESP32-S3 use LCD_CAM interface.
.ledc_channel = LEDC_CHANNEL_0,
.pixel_format = PIXFORMAT_YUV422,//PIXFORMAT_YUV422, //PIXFORMAT_YUV422,//PIXFORMAT_JPEG,
.frame_size = FRAMESIZE_HD, //FRAMESIZE_VGA,//FRAMESIZE_UXGA,//FRAMESIZE_VGA,
According to the sc101iot.c file, the SC101IOT sensor only supports the PIXFORMAT_YUV422 format.
static int set_pixformat(sensor_t *sensor, pixformat_t pixformat)
{
int ret=0;
sensor->pixformat = pixformat;
switch (pixformat) {
case PIXFORMAT_RGB565:
case PIXFORMAT_RAW:
case PIXFORMAT_GRAYSCALE:
ESP_LOGE(TAG, "Not support");
break;
case PIXFORMAT_YUV422: // For now, sc101 sensor only support YUV422.
break;
default:
ret = -1;
}
return ret;
}
I am curious to know how testing was done to support a resolution of 1280 x 720 for the SC101IOT sensor.
Sorry for the late reply. Yes, ESP32S3 currently supports SC101iot. Here are some instructions after testing. Please note that you must use ESP32S3 instead of ESP32, as the DVP interface of ESP32 has a low speed and is not very suitable for handling YUV422 format data.
@WangYuxin-esp
Thank you for your response. I've been using frame_size=FRAMESIZE_HD (1280x720), and it's working, but I'm only getting 0.5 frames per second (fps). Below is my code. Can you please provide guidance on how to improve the fps?
.pin_pclk = CAM_PIN_PCLK,
.xclk_freq_hz = 10000000,//6000000,//CONFIG_XCLK_FREQ,
.ledc_timer = LEDC_TIMER_0, // This is only valid on ESP32/ESP32-S2. ESP32-S3 use LCD_CAM interface.
.ledc_channel = LEDC_CHANNEL_0,
.pixel_format = PIXFORMAT_YUV422,//PIXFORMAT_YUV422, //PIXFORMAT_YUV422,//PIXFORMAT_JPEG,
.frame_size = FRAMESIZE_HD, //FRAMESIZE_SVGA, // FRAMESIZE_QQVGA, //QQVGA-UXGA Do not use sizes above QVGA when not JPEG
// .jpeg_quality = 12, //0-63 lower number means higher quality
// .fb_count = 2, //if more than one, i2s runs in continuous mode. Use only with JPEG
// .grab_mode = CAMERA_GRAB_LATEST
.jpeg_quality = 50,//10,
.fb_count = 1,
.fb_location = CAMERA_FB_IN_PSRAM,
.grab_mode = CAMERA_GRAB_LATEST,
.conv_mode = YUV422_TO_RGB565,
Yes, because the data size in YUV422 format is relatively large, the maximum frame rate may only reach 3fps when working at 720p resolution. If you need a higher resolution, it is recommended to choose a sensor that can output JPEG format.
In the current configuration, I suggest setting the fb_count
to 2, which may lead to an improvement in frame rate.
@WangYuxin-esp Thank you for your response. 3fps is sufficient for my product, but when I set xclk_freq_hz to 1000000 and fb_count to 2, I'm only getting 0.2fps, and I keep receiving EV-EOP-OVF warnings in the logs as shown below:
I'm curious about how you achieved 3fps. Below is my configuration:
esp_err_t init_camera(void)
{
camera_config_t detection_config = {
.pin_pwdn = CAM_PIN_PWDN,
.pin_reset = CAM_PIN_RESET,
.pin_xclk = CAM_PIN_XCLK,
.pin_sccb_sda = CAM_PIN_SIOD,
.pin_sccb_scl = CAM_PIN_SIOC,
.pin_d7 = CAM_PIN_D7,
.pin_d6 = CAM_PIN_D6,
.pin_d5 = CAM_PIN_D5,
.pin_d4 = CAM_PIN_D4,
.pin_d3 = CAM_PIN_D3,
.pin_d2 = CAM_PIN_D2,
.pin_d1 = CAM_PIN_D1,
.pin_d0 = CAM_PIN_D0,
.pin_vsync = CAM_PIN_VSYNC,
.pin_href = CAM_PIN_HREF,
.pin_pclk = CAM_PIN_PCLK,
.xclk_freq_hz = 1000000,//6000000,//CONFIG_XCLK_FREQ,
.ledc_timer = LEDC_TIMER_0, // This is only valid on ESP32/ESP32-S2. ESP32-S3 use LCD_CAM interface.
.ledc_channel = LEDC_CHANNEL_0,
.pixel_format = PIXFORMAT_YUV422,//PIXFORMAT_YUV422, //PIXFORMAT_YUV422,//PIXFORMAT_JPEG,
.frame_size = FRAMESIZE_HD, //FRAMESIZE_SVGA, // FRAMESIZE_QQVGA, //QQVGA-UXGA Do not use sizes above QVGA when not JPEG
// .jpeg_quality = 12, //0-63 lower number means higher quality
// .fb_count = 2, //if more than one, i2s runs in continuous mode. Use only with JPEG
// .grab_mode = CAMERA_GRAB_LATEST
.jpeg_quality = 20,//10,
.fb_count = 2,
.fb_location = CAMERA_FB_IN_PSRAM,
.grab_mode = CAMERA_GRAB_LATEST,
.conv_mode = YUV422_TO_RGB565,
};//CAMERA_GRAB_LATEST. Sets when buffers should be filled
esp_err_t err = esp_camera_init(&detection_config);
if (err != ESP_OK)
{
ESP_LOGE(TAG, "detect Camera init failed with error 0x%x", err);
return err;
}
sensor_t *s = esp_camera_sensor_get();
s->set_vflip(s, 1);//flip it back
return ESP_OK;
}
I would greatly appreciate your guidance on achieving the desired 3fps with the specified parameters.
From the test example, it seems that you have also used the JPEG encoding function. Unfortunately, the current JPEG encoding is implemented by software, and its encoding rate for 720p resolution images is limited.
If you need a high resolution and frame rate, I suggest using a sensor with jpeg encoding function. You can also follow our new chip, ESP32-P4, which will have a hardware encoder and support cameras with MIPI-CSI and DVP interfaces.
Thank you very much for your patient answer..
Does SC101IOT support a resolution of 1280 x 720? I ran the 'take picture' example with the following configuration: .xclk_freq_hz = 20000000, .pixel_format = PIXFORMAT_YUV422, .frame_size = FRAMESIZE_HD. During the program execution, the log continuously outputs: cam_hal: EV-EOF-OVF. I am using ESP32S3. Could you please let me know what is the highest supported resolution for SC101IOT? If it supports FRAMESIZE_HD, how should I configure it or which example should I run? Here is my code: