Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Lately I tried my Android app with opencv 2.4.0 on Jelly Bean and I got the same error. I solved it by removing the following two lines in ViewBase.setPreview

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
     mCamera.setPreviewTexture( new SurfaceTexture(10) );
 else
     mCamera.setPreviewDisplay(null);

and replaced it with

 mCamera.setPreviewDisplay(mHolder);

Now it's not possible to write to the SurfaceView that was originally used for the preview because the canvas is constantly locked. So I removed the writing-to-the-canvas stuff from the ViewBase's thread and registered a callback in the View which is executed in onProcessFrame so that I have the image data some where else. Now I can process the image data and write it to another SurfaceView which overlays the original camera output.