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);

Who is online

Users browsing this forum: No registered users and 34 guests