4
$\begingroup$

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.

$\endgroup$
3

1 Answer 1

3
$\begingroup$
img = Import["https://i.sstatic.net/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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.