Using SurfaceTexture in combination with RenderScript

后端 未结 1 555
庸人自扰
庸人自扰 2021-02-18 18:35

I want to do camera image processing on the GPU on android.

In my current set-up I use a SurfaceTexture to capture frames from the camera image stream as an OpenGL ES te

1条回答
  •  面向向阳花
    2021-02-18 19:00

    If I understand correctly, you already use SurfaceTexture. You can then register a callback with setOnFrameAvailableListener.

    I see two solutions :

    1. Implements you own RSTextureView, which inherits from SurfaceTexture.OnFrameAvailableListener. Register your view as the SurfaceTexture callback. Every time your surface view is updated by the camera stream, your RSTextureView will be notified and you can handle it the way you want.

    2. Another solution would be to implement your own RenderScriptGL (still inheriting from SurfaceTexture.OnFrameAvailableListener) and call setSurfaceTexture when the callback is called.

    You should be able to combine RenderScript with a SurfaceTexture with at least one of these two solutions.

    0 讨论(0)
提交回复
热议问题