Skip to content

Poll for frame data if acquisition fails after OnCaptureCompleted#22343

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
komakai:android_cam_polling
Sep 19, 2022
Merged

Poll for frame data if acquisition fails after OnCaptureCompleted#22343
asmorkalov merged 1 commit intoopencv:4.xfrom
komakai:android_cam_polling

Conversation

@komakai
Copy link
Copy Markdown
Contributor

@komakai komakai commented Aug 4, 2022

Pull Request Readiness Checklist

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch

Bugfix / Android:
On certain models (for example the OneNote 8T) grabFrame fails to obtain frame data even after an onCaptureComplete callback has been received. This PR fixes this problem by polling for frame data until we get a frame or we exceed a timeout of 2 second.

@asmorkalov
Copy link
Copy Markdown
Contributor

@komakai Thanks a lot for the contribution! CAPTURE_POLL_INTERVAL_MS 10ms is to large IMHO. 33ms is whole frame time for 30fps camera. It makes sense to reduce the delay to 3-5ms. It should be enough to finalize memory copy from camera to RAM or other hardware specific steps.

@komakai
Copy link
Copy Markdown
Contributor Author

komakai commented Sep 18, 2022

@asmorkalov Thanks for reviewing. In my tests it was only when getting the very first frame that polling was needed - so there was no problem with smoothness of the camera feed. But I think its a good point - I'll reduce the poll interval to 5ms

@komakai komakai force-pushed the android_cam_polling branch from dff4f78 to b3adffe Compare September 18, 2022 04:43
@komakai
Copy link
Copy Markdown
Contributor Author

komakai commented Sep 18, 2022

@asmorkalov could you also review #22332 when you have a chance?

@asmorkalov asmorkalov self-requested a review September 19, 2022 05:50
@asmorkalov asmorkalov self-assigned this Sep 19, 2022
@asmorkalov asmorkalov merged commit 0ac67ee into opencv:4.x Sep 19, 2022
@alalek alalek mentioned this pull request Jan 8, 2023
@asmorkalov asmorkalov added this to the 4.7.0 milestone Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants