Background
In a photographic work, the background blur can be a good foil to the subject, but for some photographers, the large aperture is too expensive, telephoto lens use too much, the camera is too low in the hand ... Although the conditions are not enough, but also want to shoot the main body prominent, the background of the image of the blur, what should be done? Next, this article briefly introduces the steps of background blur.
Steps
- Cutout to get the foreground area of the image
- Use Gaussian blur on the background to get the layer
- Overlay the original foreground area to the corresponding area of the layer from the second step
Note: In the first step, you can use a lot of cutout algorithms that you can look for here.
In the second step, it's best to use some edge-preserving blur filters, where I use domain Transform filter
# #代码
%InputPhotographI= Imread (' Pencils.png ');I= Im2double (I); IR =I(:,:,1); IG =I(:,:,2); IB =I(:,:,3);% Joint ImageJ = Imread (' Pencils_joint_depth.png '); j = im2double (j); BW = IM2BW (J,0.5);%Depth-of-field examplessigma_s =Ten; sigma_r =0.2;% Edges superimposed. F_NC = NC (I, sigma_s, Sigma_r,3, J);%composition out= F_nc;outr = out(:,:,1); OUTG = out(:,:,2); OutB = out(:,:,3); OUTR (BW) = IR (BW), OUTG (BW) = IG (BW); OutB (BW) = IB (BW); out= Cat (3, OUTR,OUTG,OUTB);%ShowResults.figure, Imshow (I); Title' Input photograph '); figure, Imshow ( out); Title' Filtered photograph ');
Results
Read more
Http://www.g-photography.net/old/teach/news_693.html?g4
http://www.alphamatting.com/
http://www.inf.ufrgs.br/~eslgastal/DomainTransform/
Bokeh of image background