Captured image lags by one frame
QuirkyCort opened this issue · 0 comments
Not really a bug, but something that may need to be better documented.
In this driver, the camera grab mode is set to CAMERA_GRAB_WHEN_EMPTY
. When we run camera.capture()
, it retrieves the last captured image from the framebuffer (...which might be a long time ago), and triggers a new image capture (...which will be retrieved on the next camera.capture()
).
This has a notable impact when using RGB or YUV mode. If you run...
camera.init(0, format=camera.RGB565, fb_location=camera.PSRAM)
camera.framesize(camera.FRAME_240X240)
buf = camera.capture()
...it will fail with the error message...
cam_hal: FB-SIZE: 115200 != 614400
I'm guessing that the first image was captured on init
at the default framesize of VGA (614400 bytes), while the FRAME_240X240
size is 115200 bytes, and this leads to an incorrect framebuffer size.
If you set the framesize in init
, things works (...sorta[1]) fine.
camera.init(0, format=camera.RGB565, fb_location=camera.PSRAM, framesize=camera.FRAME_240X240)
buf = camera.capture()
[1] I'm getting a greenish hue on the first couple of images, but the rest looks good.