框架
[1]對low-resolution進行上采樣,得到大小與原圖一樣大小的high-resolution 記作:D(0).
[2]迭代模塊:基于當(dāng)前深度圖D(i)建立costVolume: Ci.
[3]在costVolume的每個切片中執(zhí)行雙邊濾波以產(chǎn)生新的costVolume
[4]D(i+1):基于該costVolume首先選擇具有最小成本的深度假設(shè)和之后的子像素估計.
1.Construction and re?nement of the cost volume
選擇平方差作為成本函數(shù),因為我們稍后將使用二次多項式插值用于子像素估計浑塞。 該成本函數(shù)可以幫助保持輸入深度圖的子像素精度巷折。
可以通過顏色信息膏燕,獲得立體空間超分辨率的銳利/真實深度邊緣,接下來采用BF:
y, x are the indices of the current pixel in the camera image,
and u, v are two variables.γc and γs are two constants used as the thresholds of the color difference and the ?lter size.
2.Sub-pixel Estimation
為了減少由深度假設(shè)選擇過程中的量化引起的不連續(xù)性咽袜,基于二次多項式插值提出了子像素估計算法讹开。
d is the discrete depth with the minimal cost
d_ = d ? 1, and d+ = d + 1.
Xmin的估計值為上式
matlab code:
function Result = LayeredBilateralFilter(color,depth,sigma_w,sigma_c,w,DepthInteval,IterativeTime)
%% Initialization
L=10000;
k=1;
D(:,:,1) = double(depth);
CandidateD = 0:DepthInteval:255;
height = size(color,1);
width = size(color,2);
color = double(color);
CostVolume=zeros(height,width,length(CandidateD));
CostCW=zeros(height,width,length(CandidateD));
%% Iterative Module
while 1
for i=1:length(CandidateD)
CostVolume(:,:,i) = min(L,(CandidateD(i)-D(:,:,k)).^2); %Cost Volume C(i)
CostCW(:,:,i) = BilateralFilter(color,CostVolume(:,:,i),sigma_w,sigma_c,w); %A bilateral filtering is performed throughout each slice of the cost volume to produce the new cost volume
% Compare with the reference, the color space is different
end
[BestCost,BestDepthLocation] = min(CostCW,[],3); %Selecting the depth hypothesis with the minimal cost
% Sub-pixel estimation
CostUpper = zeros(height,width);
CostLower = zeros(height,width);
for i = 1:length(CandidateD)
CostUpper = CostUpper + CostCW(:,:,i).*((BestDepthLocation+1)==i);
CostLower = CostLower + CostCW(:,:,i).*((BestDepthLocation-1)==i);
end
k = k + 1;
D(:,:,k) = CandidateD(BestDepthLocation) - DepthInteval * (CostUpper-CostLower) ./ (2*(CostUpper+CostLower-2*BestCost));
% end of sub-pixel estimation
if IterativeTime==k
break;
end
end
Result = D(:,:,IterativeTime);
end
.