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?
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);
to create an ArrayByte for B4R, you can try like this example:
B4X:
ArrayByte* B4RTEST1::testArrayByte(byte a, byte b)
{
byte* raw = rcs->testArrayByte(a, b);
uint16_t len = 2; //or raw.size() or fixe value depending of the arduino part
ArrayByte* arr = CreateStackMemoryObject(ArrayByte);
arr->data=raw;
arr->length=len;
return arr;
};