資源簡介
我們提出了一種基于超分辨和焦外虛化渲染的光場重聚焦方法。本方法將超分辨和焦外虛化渲染按照場景深度加權整合在一起,同時實現聚焦區域的超分辨以及焦外區域的虛化渲染,從而可以利用多個低質量的攝像頭合成單反相機級別的攝影圖像。另外,本算法可以后期調節聚焦深度與景深,從而可以根據實際場景渲染出具有美學價值的攝影圖像。算法的相關細節請參考論文:
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))??-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
- 上一篇:精通openstack第二版
- 下一篇:MATLAB教程 全面PPT
評論
共有 條評論