5.论文阅读:Guided Depth Enhancement via Anisotropic Diffusion

1.

假设我们得到一个对齐的深度 - 颜色图像对。 深度图包含无效区域或者具有比成对彩色图像低的分辨率。 彩色图像被假定为无影的。 我们分别通过D(p)和I(p)表示像素p =(x,y)的深度和颜色。 p在图像域Ω中。 具有已知深度值的像素被称为种子像素,其形成集合S.如果将种子像素视为热源,则可以通过从这些图像开始在图像上扩散热(即深度)来进行深度增强 来源。 扩散过程由以下偏微分方程表示:

5.论文阅读:Guided Depth Enhancement via Anisotropic Diffusion_第1张图片

其中W(p; t)是在时间t处位置p处的扩散电导,D0(p)是初始状态下的深度。 电导是取决于给定的颜色引导图像的空间变化项,导致等式是各向异性扩散

2.

5.论文阅读:Guided Depth Enhancement via Anisotropic Diffusion_第2张图片

等式的解对应于我们期望实现的增强深度图。当给出初始深度图时,增强质量高度取决于W(p)的选择。

3.

首先将离散深度图构造为图G =(V,E),其中V是一组顶点,即像素,E包含表示4连邻域的边。

5.论文阅读:Guided Depth Enhancement via Anisotropic Diffusion_第3张图片

如果我们将深度图视为一个列向量D,则等式D(P)变为如下

其中L是单位矩阵,w是N×N矩阵。 N是整个图像的像素的总数。 给定初始深度图D0,D的平滑解可以通过求解线性系统AD = b来计算.

5.论文阅读:Guided Depth Enhancement via Anisotropic Diffusion_第4张图片

这里,p和q对应于列矢量D中的像素p和q的索引。
注意A是稀疏和正定义矩阵。 因此,引导深度增强被转换为稀疏线性系统,可以有效地解决。

matlab code:

function result = AnisotropicDiffusion(color,depth,sigma_w,data_weight)
if( size(color,3) ~= 3 ),
    error( 'color data must be of 3 channel' );
end
if ~exist( 'data_weight', 'var' ),
    data_weight = 100;
end
height = size(color,1);
width = size(color,2);
pixelNumber = height * width;

tic;
depth = double(depth);
Z = sparse(reshape(depth,pixelNumber,1)) * data_weight;

color = double(color);
S = ADMatrix(color,depth,sigma_w,data_weight);

fprintf('    The running time of getting A and b is %.5f s\n',toc);
Result = S\Z;
BackslashTime=toc;
fprintf('    The running time of solving Ax=b by Backslash is %.5f s\n',BackslashTime)

result = full(reshape(double(Result),height,width));
fprintf('    Done!\n')


function output = ADMatrix(color,depth,sigma,data_weight)
height = size(color,1);
width = size(color,2);
number = height * width;
x = zeros(height * width * 5,1);
y = zeros(height * width * 5,1);
s = zeros(height * width * 5,1);
count = 1;
colorN3 = reshape(color,number,3);
for i = 1:height 
    for j = 1:width
        
        pos = height*(j-1)+i;
       
        temp = [pos - 1, pos + 1, pos - height, pos + height];
        judge = zeros(4,1);
        judge(1) = mod(temp(1),height) ~= 0;
        judge(2) = mod(temp(2),height) ~= 1;
        judge(3) = temp(3) - height > 0;
        judge(4) = temp(4) + height < number;
        judge = logical(judge);
        validNumber = sum(judge);
        
        w = exp(-1/(2*sigma^2)*sum(( repmat(colorN3(pos,:),validNumber,1) - colorN3(temp(judge),:)).^2,2)); 

        x(count:count+validNumber-1) = pos*ones(validNumber,1);
        y(count:count+validNumber-1) = temp(judge);
        s(count:count+validNumber-1) = -w/sum(w);
        count = count + validNumber;
        x(count) = pos;
        y(count) = pos;
        if depth(i,j)==0
            s(count) = 1;
        else
            s(count) = data_weight + 1;
        end
        count = count + 1;
    end
end
x = x(1:count-1);
y = y(1:count-1);
s = s(1:count-1);
output = sparse(x,y,s,number,number);

end

你可能感兴趣的:(5.论文阅读:Guided Depth Enhancement via Anisotropic Diffusion)