Hide camera preview but still get preview preview callbacks

I want to show a filtered camera view in my application.

I am using Camera.setPreviewCallback () for this. I was able to process the callback data and show the filtered image in the OpenGL view, but I don't know how to hide the camera preview and still receive the preview callbacks. Making a surface view "gone" or "invisible" doesn't work, making it small enough (10x10) to hide behind a GUI doesn't work either. It just stops sending the callbacks with the preview data.

Can you share a workaround? I am testing Galaxy S2.

Thanks in advance.

+3


source to share


2 answers


The solution is to set the preview size to the actual screen, in the onMeasure Preview of the SurfaceView to make it smaller, which works for me:



@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{  
   this.setMeasuredDimension(2, 2);  
}

      

+2


source


Create a simple look with a black background color. Position the view in the same position as the SurfaceView camera. The camera preview will be effectively hidden.



+1


source







All Articles