Jaeger
Jaeger

Reputation: 1

image processing during camera2 and overlay results (drawings) on textureview

I’m using the Android camera2 example and trying to get the preview image of the camera, process it and overlay results on the rendered TextureView which is initially used to display the camera preview. Similar to QR-code detection and overlaying a rectangle on detected code. tried several approach but did not work. No glue how to do that. For example I tried to manipulate the SurfaceTexture during TextureView.SurfaceTextureListener.onSurfaceTextureUpdated

Upvotes: 0

Views: 181

Answers (1)

Eddy Talvala
Eddy Talvala

Reputation: 18107

The easiest way is to overlay another View on top of the TextureView, and draw on it (with a mostly transparent output) via a Canvas or similar.

You can't directly add other content to the TextureView that's being used for camera output. If you really want to render preview and your UI to the same view, then you need a custom GLSurfaceView or similar, and receive the camera preview as a texture via a SurfaceTexture. Then you can render it and your UI in any way you want, but it's a lot of boilerplate to set up EGL.

Upvotes: 1

Related Questions