how can i blur the background?
4 views (last 30 days)
Show older comments
Hello, I want to blur the background not the man. please help as soon as possible.
1 Comment
Walter Roberson
on 3 May 2024
Note that in the general case, it is impossible for a program to automatically select which part of the image is "background" and which part is "foreground".
Consider the images produced by SOHO, the solar observatory. The images are primarily intended for observing the Sun, in which case you ignore everything outside of the solar disk. But if you take the same images and mask out the solar disk then you can observe objects moving close to the solar disk -- comets!
So in one case you ignore everything outside of the solar disk, and in the other case you ignore the solar disk, and so using the same image you can get two different purposes. The foreground for one purpose is the background for the other purpose.
Therefore it is impossible to automatically select foreground versus background: the "noise" for one purpose might easily be the "signal" for a different purpose.
Answers (2)
DGM
on 3 May 2024
There are several answers already. Here's the latest one. See the links therein.
0 Comments
Image Analyst
on 3 May 2024
You can try the foreground detector in the Computer Vision Toolbox.
help foregrounddetector
I have no idea how will its algorithm will work for your particular image(s).
Otherwise you can manually trace the foreground with drawfreehand to make a mask. Then blur the entire image and assign the blurred pixels inside the mask to the original unblurred image. Like for once you have the mask:
h = ones(15);
filteredRGB = imfilter(originalRGB, h);
[r,g,b] = imsplit(rgbImage);
[rf, gf, bf] = imsplit(filteredRGB);
r(mask) = rf(mask);
g(mask) = gf(mask);
b(mask) = bf(mask);
outputImage = cat(3, r, g, b);
See attached drawing demos for creating and masking images.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!