Description
Checklist
- Checked the issue tracker for similar issues to ensure this is not a duplicate
- Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
- Tested with the latest version to ensure the issue hasn't been fixed
How often does this bug occurs?
always
Expected behavior
cam_hal.c , cam_config, line 377
if(cam_obj->jpeg_mode){
#ifdef CONFIG_CAMERA_JPEG_MODE_FRAME_SIZE_AUTO
cam_obj->recv_size = cam_obj->width * cam_obj->height / 5;
#else
cam_obj->recv_size = CONFIG_CAMERA_JPEG_MODE_FRAME_SIZE;
#endif
cam_obj->fb_size = cam_obj->recv_size;
} else {
//I expected if it is greyscale, you may handle here and do : cam_obj->fb_size = cam_obj->width * cam_obj->height
cam_obj->recv_size = cam_obj->width * cam_obj->height * cam_obj->in_bytes_per_pixel;
cam_obj->fb_size = cam_obj->width * cam_obj->height * cam_obj->fb_bytes_per_pixel;
}
Actual behavior (suspected bug)
cam_hal.c , cam_config, line 377
if(cam_obj->jpeg_mode){
#ifdef CONFIG_CAMERA_JPEG_MODE_FRAME_SIZE_AUTO
cam_obj->recv_size = cam_obj->width * cam_obj->height / 5;
#else
cam_obj->recv_size = CONFIG_CAMERA_JPEG_MODE_FRAME_SIZE;
#endif
cam_obj->fb_size = cam_obj->recv_size;
} else {
//I expected if it is greyscale, you may handle here and do : cam_obj->fb_size = cam_obj->width * cam_obj->height
cam_obj->recv_size = cam_obj->width * cam_obj->height * cam_obj->in_bytes_per_pixel;
cam_obj->fb_size = cam_obj->width * cam_obj->height * cam_obj->fb_bytes_per_pixel;
}
Error logs or terminal output
I (816) s3 ll_cam: DMA Channel=0
I (818) cam_hal: cam init ok
I (821) sccb-ng: pin_sda 4 pin_scl 5
I (824) sccb-ng: sccb_i2c_port=1
I (838) camera: Detected camera at address=0x30
I (841) camera: Detected OV2640 camera
I (841) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
I (915) s3 ll_cam: node_size: 3200, nodes_per_line: 1, lines_per_node: 1
I (915) s3 ll_cam: dma_half_buffer_min: 3200, dma_half_buffer: 16000, lines_per_half_buffer: 5, dma_buffer_size: 32000
I (921) cam_hal: buffer_size: 32000, half_buffer_size: 16000, node_buffer_size: 3200, node_cnt: 10, total_cnt: 240
I (931) cam_hal: Allocating 1920000 Byte frame buffer in PSRAM
I (937) cam_hal: Allocating 1920000 Byte frame buffer in PSRAM
I (942) cam_hal: cam config ok
I (945) ov2640: Set PLL: clk_2x: 1, clk_div: 7, pclk_auto: 1, pclk_div: 12
E (956) cam_hal: FB-SIZE: 0 != 1920000
I (1042) ov2640: Set PLL: clk_2x: 1, clk_div: 7, pclk_auto: 1, pclk_div: 12
E (1352) cam_hal: FB-SIZE: 704000 != 1920000
cam_hal: EV-VSYNC-OVF
cam_hal: EV-VSYNC-OVF
cam_hal: EV-VSYNC-OVF
Steps to reproduce the behavior
- do changes needed for cam_obj->greyscale_mode
- handle it one more else if (cam_obj->greyscale_mode)
} else {
//I expected if it is greyscale, you may handle here and do : cam_obj->fb_size = cam_obj->width * cam_obj->height
cam_obj->recv_size = cam_obj->width * cam_obj->height * cam_obj->in_bytes_per_pixel;
cam_obj->fb_size = cam_obj->width * cam_obj->height * cam_obj->fb_bytes_per_pixel;
}
Project release version
latest
System architecture
Intel/AMD 64-bit (modern PC, older Mac)
Operating system
Windows
Operating system version
win 11
Shell
CMD
Additional context
camera_config_t camera_config = {
.pin_pwdn = -1,
.pin_reset = -1,
.pin_xclk = 15,
.pin_sscb_sda = 4,
.pin_sscb_scl = 5,
.pin_d7 = 16,
.pin_d6 = 17,
.pin_d5 = 18,
.pin_d4 = 12,
.pin_d3 = 10,
.pin_d2 = 8,
.pin_d1 = 9,
.pin_d0 = 11,
.pin_vsync = 6,
.pin_href = 7,
.pin_pclk = 13,
.xclk_freq_hz = 20000000,
.pixel_format = PIXFORMAT_GRAYSCALE, // RGB565'ten JPEG'e değiştirildi
.frame_size = FRAMESIZE_UXGA,
.jpeg_quality = 1, // JPEG kalitesi artırıldı
.fb_count = 2,
.fb_location = CAMERA_FB_IN_PSRAM,
.grab_mode = CAMERA_GRAB_WHEN_EMPTY
};
esp_err_t err = esp_camera_init(&camera_config);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Kamera baslatilamadi: %s", esp_err_to_name(err));
return;
}
sensor_t *s = esp_camera_sensor_get();
if (s) {
//s->set_framesize(s, FRAMESIZE_240X240);
s->set_quality(s, 1); // JPEG kalitesi - biraz düşürdük
s->set_brightness(s, -2); // Parlaklığı azalttık
s->set_contrast(s, 2); // Kontrastı artırdık
s->set_saturation(s, 0); // Normal satürasyon
s->set_sharpness(s, 2); // Keskinliği artırdık
s->set_denoise(s, 1); // Gürültü azaltma açık
s->set_gainceiling(s, GAINCEILING_4X); // Gain kontrolü
s->set_whitebal(s, 1); // Otomatik beyaz dengesi
s->set_exposure_ctrl(s, 1); // Otomatik pozlama kontrolü açık
s->set_awb_gain(s, 1); // Otomatik beyaz dengesi gain kontrolü
s->set_aec2(s, 0); // AEC DSP kontrolünü kapattık
s->set_ae_level(s, -2); // AEC seviyesini düşürdük
s->set_aec_value(s, 300); // Manuel pozlama süresi
s->set_gain_ctrl(s, 1); // Otomatik gain kontrolü
s->set_agc_gain(s, 0); // Manuel gain değeri
s->set_bpc(s, 1); // Bad pixel düzeltme açık
s->set_wpc(s, 1); // Beyaz piksel düzeltme açık
s->set_raw_gma(s, 1); // Gamma düzeltme
s->set_lenc(s, 1); // Lens düzeltme
s->set_res_raw(s, 0/*OV2640_MODE_UXGA*/, 0, 0, 0, 600, 300, 800, 600, 800, 600, false, false);
s->set_hmirror(s, 0); // Yatay ayna kapalı
s->set_vflip(s, 0); // Dikey çevirme kapalı
s->set_dcw(s, 1); // Downsize EN
s->set_colorbar(s, 0); // Test pattern kapalı
}