I have a camera preview in my android app. As you all probably know it is implemented by a surfaceview in android.

In my photo app, which allows users to take pictures, I want to blur the camera preview (the surface view) if the user has not logged in yet if the user is logged in, I will display the normal preview (without blur)

Blur as something like

enter image description here

But there seems to be no way to do it

Couple things come to mind but I am not sure how to achieve it

  1. use a blur overlay and place it on top of the surface view, but how do u create such blur overlay?
  2. another approach is to change the attribute of the window, but I can't do it to surfaceview,

     getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    

So can we create a window overlay the surfaceview and set the flag like that? I don't think so

can someone tell me how to blur a camera preview, which is a surface view

note: I am trying to blur an area which is the output from camera preview, so it is not like I am blurring a static image, the blur area will change depending on where you point your phone camera

Edit
Report