1

I have been trying how to figure out how to apply blurs on videos from the camera in Android, but have only been able to find blur affects applied to images. I want to be able to blur in real time a camera feed I receive from someone, or my own video preview screen that is on a SurfaceView or GlSurfaceView and was wondering if this is possible? Thanks

Steven Kz
  • 21
  • 3

1 Answers1

1

I assume that what you want is something like this. (The video is a bit old; issues like the stretching have been fixed.)

If so, the Grafika "show + capture camera" activity shows what you want. The idea is to capture the camera to a SurfaceTexture, then render that texture using a GLES fragment shader. The Grafika class uses a 3x3 filter kernel, and can handle 30fps video on most devices. (It's pretty slow on the original Nexus 7, but that should be correctable by optimizing the shader.)

I'd recommend SurfaceView over GLSurfaceView (see other activities, e.g. "continuous capture" or "texture from camera", for that), as managing EGL yourself makes life easier.

fadden
  • 51,356
  • 5
  • 116
  • 166
  • Wow, I think this is exactly what we need. Thank you very much. I think we have to go with GLSurfaceView because we need to send the information out – Steven Kz Jul 24 '14 at 11:13
  • The blur is hardly noticeable, i am trying for an effect like Gaussian blur but am unable to work out how to do with with a 3x3 – Joe Maher Mar 21 '16 at 07:50
  • @JoeMaher: open a new question. Show what you've tried so far (e.g. the 3x3 matrix), maybe include a link that shows the effect you're trying to achieve. – fadden Mar 21 '16 at 15:36
  • @fadden i have posted a question [here](http://stackoverflow.com/questions/36143513/android-gaussian-blur-like-effect-opengl) thanks – Joe Maher Mar 21 '16 at 23:26