B4R Question uint8_t - some questions

hatzisn

Expert
Licensed User
Longtime User
Here is a line of code in C++.

C++:
uint8_t *jpeg_buf = (uint8_t*) pic->buf;

the pic is an ESP32CAM image of type camera_fb_t so I suppose the buf is the buffer of the image taken.

The question is what is the jpeg_buf? Is it a conversion of all the buf[ii] to uint8_t? So jpeg_buf is an array of uint8_t numbers or am I wrong?
If it is an array of uint8_t numbers, how can I convert it to a B4R byte array?
 

hatzisn

Expert
Licensed User
Longtime User
The pic is an ESP32CAM image of type camera_fb_t which of course is not a type but a structure with the following definition:

C++:
  typedef struct {
    uint8_t *buf;
    size_t len;
    uint32_t width;
    uint32_t height;
    pixformat_t format;
} camera_fb_t;

I have managed to copy the data successfully to an in line c byte array.
Is there any way to copy with B4R byte converter this inline c byte array to a new B4R byte array?

C++:
  byte imageData[pic->len];
  // Copy the image data from the camera frame buffer to the byte array
  memcpy(imageData, pic->buf, pic->len);
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…