This is my first time on this forum, and also my first time using an ESP32-CAM, so my current understanding is quite limited.
I'm programming an ESP32-CAM (AI Thinker) with FRAMESIZE_QQVGA and PIXFORMAT_GRAYSCALE, and have come across an issue where the frame buffer does not update on the bottom half (i.e. the top half of the Serial output changes each iteration, but the bottom half does not). In addition to this, the output is 16bit, but I thought grayscale would be 8bit. Is this a problem with how I have programmed it?
Here is the loop (called with delay of 1000ms) I am using to capture the image and display the pixels (every 5th) using Serial print:
#define WIDTH 160
#define HEIGHT 120
... //in setup
config.pixel_format = PIXFORMAT_GRAYSCALE;
config.frame_size = FRAMESIZE_QQVGA;
...
bool capture_image(){
camera_fb_t * frame = NULL;
frame = esp_camera_fb_get();
if(!frame) return false;
uint16_t *data= (uint16_t*)frame->buf;
for(int row=0; row<HEIGHT; row+=5){
for(int col=0; col<WIDTH; col+=5){
int pix = row * WIDTH + col;
Serial.print((String)data[pix] + ", ");
}
Serial.println("");
}
esp_camera_fb_return(frame);
return true;
}
Thanks