T
T
titovnikita2014-03-28 20:24:49
Android
titovnikita, 2014-03-28 20:24:49

Should I use handler to handle Android streaming camera frames?

Hello!
I am writing a program for real-time text recognition on the Android platform.
Faced such a problem. Using the function onPreviewFrame(byte[] data, Camera camera)of the Camera.PreviewCallback object, I take a frame from the streaming camera. Then I pass it to the handler, where post-processing and recognition take place.
But it turns out that frames are sent too quickly to the handler, the library does not have time to recognize it, a huge queue is built in the hadler, the application either freezes or shows the text recognized 10 seconds earlier.
Tell me, please, is it worth using a handler here and how to make onPreviewFrame wait for the results of the last frame? Thank you very much!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question