资源简介

我们提出了一种基于超分辨和焦外虚化渲染的光场重聚焦方法。本方法将超分辨和焦外虚化渲染按照场景深度加权整合在一起,同时实现聚焦区域的超分辨以及焦外区域的虚化渲染,从而可以利用多个低质量的摄像头合成单反相机级别的摄影图像。另外,本算法可以后期调节聚焦深度与景深,从而可以根据实际场景渲染出具有美学价值的摄影图像。算法的相关细节请参考论文: Y. Wang, J. Yang, Y. Guo, C. Xiao, and W. An, Selective light field refocusing for camera arrays using bokeh rendering and superresolution. IEEE Signal Processing Letters, 2018.

资源截图

代码片段和文件信息

%% This function renders the bokeh in out-of-focus regions
function I_bokeh = bokeh_rendering(LF_Image Disparity slope K)

[u v row col ~] = size(LF_Image);
cu = 0.5*(u+1);
cv = 0.5*(v+1);
I_center = squeeze(LF_Image(cu cv : : :));
I_bokeh = I_center;                                 % Set the initial bokeh image as the center-view sub-image

delta_Dis = Disparity - slope*ones(size(Disparity));% Equation (5)
Radius = K*delta_Dis;
Rmax = max(abs(Radius(:)));                         % maximum radius of CoC in the image.
Patchsize = ceil(2*Rmax);                           % ensure that Patch radius is larger than Rmax
if (Patchsize/2 == round(Patchsize/2))              % ensure that Patchsize is an odd number
    Patchsize = Patchsize + 1;
end

pr = (Patchsize+1)/2;                               % Patch radius
Patch = zeros(size(Patchsize Patchsize));
ONE = ones(size(Patch));
ZERO = zeros(size(Patch));

% Calculate the weight of the anisotropic filter
for i = 1 : Patchsize
    for j = 1 : Patchsize
        Patch(i j) = sqrt((pr-i)^2+(pr-j)^2);        
    end
end

% Render the bokeh with an anisotropic filter
parfor i = pr : row-pr+1
    for j = pr : col-pr+1
        
        RPatch = squeeze(Radius(i-pr+1 : i+pr-1 j-pr+1 : j+pr-1));
        Mask = ( ONE.*double(abs(RPatch)-Patch>0.5*ONE) + ZERO.*double(Patch-abs(RPatch)>0.5*ONE) ...
             +(abs(RPatch)-Patch+0.5*ONE).*double(abs(RPatch)-Patch<=0.5*ONE).*double(Patch-abs(RPatch)<=0.5*ONE) )...
             .*((abs(RPatch(prpr)) < K) * double(RPatch - RPatch(prpr)*ONE > -0.2*Rmax*ONE)...
             + double(abs(RPatch(prpr)) >= K) * ONE);
        
        Mask = Mask/sum(Mask(:));
        for color = 1 : 3
            IPatch = squeeze(I_center(i-pr+1 : i+pr-1 j-pr+1 : j+pr-1 color));
            I_bokeh(i j color) = sum(double(IPatch(:)).*Mask(:));
        end
    end
end


for color = 1 : 3       % Dealing with image boundaries
    I_bokeh( : 1:pr-1 color) = repmat(I_bokeh( : pr color) 1 pr-1);
    I_bokeh( : col-pr+2:end color) =repmat(I_bokeh( : col-pr+1 color) 1 pr-1);
    I_bokeh( 1:pr-1 : color) = repmat(I_bokeh( pr : color) pr-1 1);
    I_bokeh( row-pr+2:end : color) = repmat(I_bokeh( row-pr+1 : color) pr-1 1);
end


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......      2316  2018-12-13 09:06  Wang2018Selective\bokeh_rendering.m

    .......      2443  2018-12-13 09:06  Wang2018Selective\Demo_run.m

    .......   1584310  2018-12-13 09:06  Wang2018Selective\Dolls\0101.png

    .......   1590637  2018-12-13 09:06  Wang2018Selective\Dolls\0102.png

    .......   1602782  2018-12-13 09:06  Wang2018Selective\Dolls\0103.png

    .......   1594102  2018-12-13 09:06  Wang2018Selective\Dolls\0201.png

    .......   1607089  2018-12-13 09:06  Wang2018Selective\Dolls\0202.png

    .......   1611163  2018-12-13 09:06  Wang2018Selective\Dolls\0203.png

    .......   1583282  2018-12-13 09:06  Wang2018Selective\Dolls\0301.png

    .......   1599852  2018-12-13 09:06  Wang2018Selective\Dolls\0302.png

    .......   1593405  2018-12-13 09:06  Wang2018Selective\Dolls\0303.png

    .......       319  2018-12-13 09:06  Wang2018Selective\getD.m

    .......       528  2018-12-13 09:06  Wang2018Selective\Gradient_BTV.m

    .......       390  2018-12-13 09:06  Wang2018Selective\ImWarp.m

    .......       835  2018-12-13 09:06  Wang2018Selective\L2GradientBackProject.m

    .......      1320  2018-12-13 09:06  Wang2018Selective\L2SD.m

    .......      1657  2018-12-13 09:06  Wang2018Selective\Lightfield_SR.m

    .......      2210  2018-12-13 09:06  Wang2018Selective\local_dispt_estm.m

    .......       366  2018-12-13 09:06  Wang2018Selective\maxfilter.m

    .......       707  2018-12-13 09:06  Wang2018Selective\medianfilter.m

     文件        276  2018-12-13 09:12  Wang2018Selective\readme.txt

    .......      2490  2018-12-13 09:06  Wang2018Selective\RGDP_optm.m

    .......       180  2018-12-13 09:06  Wang2018Selective\ScaleAdjust.m

     目录          0  2018-12-13 09:06  Wang2018Selective\Dolls

     目录          0  2018-12-13 09:07  Wang2018Selective

----------- ---------  ---------- -----  ----

             14382659                    25


评论

共有 条评论