ESP32 CAM direct access to image data

Posts: 6
Joined: Tue Jun 11, 2019 12:16 pm

Re: ESP32 CAM direct access to image data

Postby XenonXenon » Sat Jun 15, 2019 10:04 am


User avatar
Posts: 95
Joined: Fri Oct 27, 2017 6:58 am
Location: Eberbach, Germany

Re: ESP32 CAM direct access to image data

Postby HermannSW » Thu Jul 18, 2019 12:27 pm

XenonXenon wrote:
Wed Jun 12, 2019 2:38 pm
But I cannot find the code for dl_matrix3du_alloc anywhere and whilst the calling context makes clear that parameters 2 & 3 are width & height I do not know what parms 1 & 4 are.
From: ... ix3d.h#L68

Code: Select all

 * @brief Allocate a 3D matrix with 8-bits items, the access sequence is NHWC
 * @param n     Number of matrix3d, for filters it is out channels, for others it is 1
 * @param w     Width of matrix3d
 * @param h     Height of matrix3d
 * @param c     Channel of matrix3d
 * @return      3d matrix
dl_matrix3du_t *dl_matrix3du_alloc(int n, int w, int h, int c);
On your question on direct access to image data, in capture_handler(): ... d.cpp#L218

this is how you get rgb888 encoded frame that you can directly access (CameraWebServer "Get Still" requests JPEG, "Start Stream" requests for MJPEG stream):

Code: Select all

    fb = esp_camera_fb_get();
    s = fmt2rgb888(fb->buf, fb->len, fb->format, out_buf);
From: ... ers.h#L110

Code: Select all

 * @brief Convert image buffer to RGB888 buffer (used for face detection)
 * @param src       Source buffer in JPEG, RGB565, RGB888, YUYV or GRAYSCALE format
 * @param src_len   Length in bytes of the source buffer
 * @param format    Format of the source image
 * @param rgb_buf   Pointer to the output buffer (width * height * 3)
 * @return true on success
bool fmt2rgb888(const uint8_t *src_buf, size_t src_len, pixformat_t format, uint8_t * rgb_buf);

Posts: 1
Joined: Fri Jul 24, 2020 2:38 pm

Re: ESP32 CAM direct access to image data

Postby mrstanlez » Fri Jul 24, 2020 2:48 pm


I have problem with JPEG buffer to RGB data. I cant read red pixels with SVGA / XGA resolutions, if JPEG Format is captured into framebuffer. And another problem is that PSRAM is always lower and after 4th captured picture my module is restarted. Below code don't works. Any help ? Thank you.

Code: Select all

uint8_t *out_buf = (uint8_t*)ps_malloc(out_len);
fmt2rgb888(fb->buf, fb->len, fb->format, out_buf);  

Who is online

Users browsing this forum: No registered users and 15 guests