Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Captured image lags by one frame #95

Open
QuirkyCort opened this issue Apr 24, 2024 · 0 comments
Open

Captured image lags by one frame #95

QuirkyCort opened this issue Apr 24, 2024 · 0 comments

Comments

@QuirkyCort
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant