I have been working on a Mobile application that analyzes the frame looking for specific objects. The processing was to heavy, and I keep getting
05-08 17:44:24.909: I/Choreographer(31606): Skipped 114 frames! The application may be doing too much work on its main thread.
So i switched the image processing to threads, now it is much faster but I am not able to recognize any object . The data(the different frames) is not updating and I don't know why. Here is what I'm doing in pseudocode( SurfaceHolder.Callback ,Camera.PreviewCallback and camera.addCallbackBuffer(data) are implemented )
public void onPreviewFrame(byte[] data, Camera camera)
{
Imageprocessor np = new ImageProcessor(data);
np.start()
results = np.getResults();
}
From the debugging I have done so far I know that start is analyzing the whole frame, but . the data is not updating it keeps stacked at the very first frame. This does not happen if I do it in the main Thread like this,
public void onPreviewFrame(byte[] data, Camera camera)
{
Imageprocessor np = new ImageProcessor();
np.process(data)
results = np.getResults();
}
This works but it force me to skip many frames. The answer may be easy, but I could not find it online.
Forgive me if I am posting a very noob question
Thanks in advance