I'm using the Camera2 API to show the camera stream on a TextureView
. Since the dimensions of the camera do not match the device, I apply a transformation matrix. However this gives me black borders on top and bottom. I would like to fill the borders with a blurred copy similar to this:
What is the best way to implement this? Here are some things I thought about:
- The texture is automatically stretched down by the TextureView. Before this, I could stretch it even bigger, then somehow apply the blur to it. This has the downside that I need a very big temporary texture, and I don't know how to stretch it or blur it.
- Apply a shader. There is plenty of example code to do this. The problem is that the texture doesn't extend far enough up and down. So I know how to blur the image, but not how to fill the gaps.
- Draw two textures, one blurred, one normal. Should I rather overlay two TextureViews, or draw it myself with OpenGL?