Alex Neuer
Alex Neuer

Reputation: 1

Android Camera2 API preprocessing and writing frames in SurfaceTexture

Trying to change the pixels prior to being displayed in SurfaceTexture.

SurfaceTexture signed on OnFrameAvailableListener:

 @Override 
 public void onFrameAvailable(SurfaceTexture surfaceTexture) 
 { 
    ... 
 }

as I understand it in this method and want to change the pixels, but how? Thank you very much for any answers and comments!

Upvotes: 0

Views: 691

Answers (1)

Eddy Talvala
Eddy Talvala

Reputation: 18137

How are you drawing the output from your SurfaceTexture to begin with? Are you just using the TextureView class, or do you have an actual GLSurfaceView or similar and a set of OpenGL ES drawing calls to draw the preview with?

If you're using TextureView, then there's nothing you can do - it takes care of the drawing and you can't inject yourself in the middle.

With a GLSurfaceView, you're basically writing your own OpenGL program, which can do all sorts of image processing via fragment shaders and the like. But you'll need to learn the basics of OpenGL programming for that, or at least find a sample that sets up all the boilerplate.

If you're using camera2, you could also consider using RenderScript for your processing. The official Google sample app, HdrViewfinder, uses RS to do real-time processing on preview.

Upvotes: 1

Related Questions