4

Is there a way to remove the bokeh background from photos using Mathematica? An example photo is given below.

puppy

I tried the methods that are answered here and here, but they don't seem to work.

Domen
  • 23,608
  • 1
  • 27
  • 45
codebpr
  • 2,233
  • 1
  • 7
  • 26

1 Answers1

3
img = Import["https://i.stack.imgur.com/SMAtq.jpg"]

Adding as an answer, here are two methods to remove the blurry background. There are likely several more methods.

Using RemoveBackground

The "Salient" method works well without any further modification needed:

sal = RemoveBackground[img, "Salient"]

Mathematica graphics

Using ImageSaliencyFilter

This actually might produce the same results as RemoveBackground (other than the black instead of white background), but I'm not sure.

sfil = ImageSaliencyFilter[img];
sfil*img

Mathematica graphics

ydd
  • 3,673
  • 1
  • 5
  • 17