Android Camera Onpreviewframe Callback And Rotation Sensor Callback Synchronization
I have been developing an android app which requires camera preview data for each frames,with addition to that I want pitch (Angle) values (From Rotation sensor) while capturing f
Solution 1:
One of the common pitfalls with onPreviewFrame()
callbacks is that by default these callbacks will arrive on the main UI thread, and thus can be unpredictably delayed by something else happening on the UI thread. I have explained how to easily switch to using a separate Handler Thread for camera callbacks elsewhere. Also, push the onSensorChanged()
callbacks off the UI thread.
In my experience, attributing pitch to preview frames is quite reliable with the above setup. I should confess that my current app throttles the preview stream to ~5 FPS. We don't need higher frame rate, and have quite heavy CV on each frame that we accept.
Post a Comment for "Android Camera Onpreviewframe Callback And Rotation Sensor Callback Synchronization"