0

I need to blur faces to protect the privacy of people in street view images like Google does in Google Street View. The blur should not make the image aesthetically unpleasant. I read in the paper titled Large-scale Privacy Protection in Google Street View by Google (link) that Google does the following to blur the detected faces.

We chose to apply a combination of noise and aggressive Gaussian blur that we alpha-blend smoothly with the background starting at the edge of the box.

Can someone explain how to perform this task? I understand Gaussian Blur, but how to blend it with the background?

Code will be helpful but not required

My question is not how to blur a part of image?, it is how to blend the blurred portion with the background so that blur is not unpleasant? Please refer to the quote I provided from the paper.

I have large images and a lot of them. An iterative process as in the possible duplicate will be time consuming.

EDIT

If someone ever wants to do something like this, I wrote a Python implementation. It isn't exactly what I was asking for but it does the job.
Link: pyBlur

Abdul Fatir
  • 6,159
  • 5
  • 31
  • 58
  • 1
    Possible duplicate of [How to blur some portion of Image in Android?](http://stackoverflow.com/questions/30101044/how-to-blur-some-portion-of-image-in-android) – Spektre May 19 '16 at 10:05
  • That is still the same task ... as the blurred area will blend into unblured one smoothly ... which is what you are asking for... that linked QA holds the answer... you mask will be just inverted and smoothed.... – Spektre May 19 '16 at 10:12
  • I have large images and a lot of them. An iterative process as the one in the question you provided will be time consuming. – Abdul Fatir May 19 '16 at 10:22

1 Answers1

2

I'm reasonably sure the general idea is:

  1. Create a shape for the area you want to blur (say a rectangle).
  2. Extend your shape by X pixels outwards.
  3. Apply a gradient on alpha from 0.0 .. 1.0 (or similar) over the extended area.
  4. Apply blur the extended area (ignoring alpha)
  5. Now use an alpha-blend to apply the modified image to the original image.

Adding noise in a similar way to the original image would make it further less obvious that it's been blurred (because the blur will of course also blur away the noise).

I don't know the exact parameters for how much to grow, what values to use for the alpha gradient, etc, but that's what I understand from the quoted text.

Mats Petersson
  • 126,704
  • 14
  • 140
  • 227
  • Can you explain point 3 a bit, how to do it. Also, the point about adding noise. – Abdul Fatir May 19 '16 at 07:15
  • Basically form a "wedge" of alpha values from 0 (transparent) to 1 (opaque). For ideal results, you probably want to use a gamma curve, but if the width of the blend isn't very large (say 5-20 pixels), a linear gradient is fine - so `float a; for(a = 0.0f; a < 1.0f; a += 1.0f / width) ... ` where `...` is storing that the `a` from the outside in over the grown area. – Mats Petersson May 20 '16 at 06:04
  • I would start by getting that general principle working. Adding noise would require that you first analyse the amount [and ideally the character] of noise in the image, and then apply a similar level and character to your modified area, to "add back some noise". – Mats Petersson May 20 '16 at 06:06