Page 1 of 1

esp32 cam takes old image

Posted: Tue Nov 23, 2021 10:54 am
by zella9
Hi, I try to make security system - "door opens, photo takes". But when i take photo - there is not realtime photo - seem like some old frame from internal buffer. I'm not understand how take realtime photo. Here code example which shoul give realtime photo:
  1.   server.on("/picture", HTTP_GET, [](AsyncWebServerRequest * request) {
  2.  
  3.     camera_fb_t * frame = NULL;
  4.     frame = esp_camera_fb_get();
  5.  
  6.     request->send_P(200, "image/jpeg", (const uint8_t *)frame->buf, frame->len);
  7.  
  8.     esp_camera_fb_return(frame);
  9.   });
Response gives me old photo from buffer.

Re: esp32 cam takes old image

Posted: Sat Jan 01, 2022 6:01 am
by onhiatus
Did you ever figure this out? I'm running into the same behavior.

Re: esp32 cam takes old image

Posted: Wed Apr 20, 2022 2:14 am
by Teddyz
I also face the same problem, but with Examples->ESP32->Camera->CameraWebServer
I suspect it has to do that I use Arduino IDE instead of PlatformIO, but hard to tell without switching.

Re: esp32 cam takes old image

Posted: Mon Nov 28, 2022 1:28 pm
by felixlastname
Find your answer here: https://github.com/espressif/arduino-esp32/issues/6047

Add to your code: config.grab_mode = CAMERA_GRAB_LATEST;