Is there a way to remove the bokeh background from photos using Mathematica? An example photo is given below.
I tried the methods that are answered here and here, but they don't seem to work.
Is there a way to remove the bokeh background from photos using Mathematica? An example photo is given below.
I tried the methods that are answered here and here, but they don't seem to work.
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.
The "Salient" method works well without any further modification needed:
sal = RemoveBackground[img, "Salient"]

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

RemoveBackground[img, "Salient"]works pretty well here as a quick background removal screenshot – ydd Jan 26 '24 at 16:11