Compute normal vector from depth
代码地址ComputeNormal
matlab code
代码参考Data-driven 3d primitives for single image understanding
使用matlab库函数surfnorm
算法
input: D Depth map,K Camera intrinsic
output: N Surface normal map
def GenerateSurfaceNormal(D, K)
P (X, Y, Z) <-- f(D, K)
for i in D:
S = [p_i]
for j in i neighborings:
S <-- P_j
# 最小二乘fitting
N_i <-- least_squares_fitting(S)
# 双边滤波
bilateralFilter(N, sigma_s=24, sigma_I=0.2)
return N
运行
matlab -nodesktop -nosplash -r generate_normal_gt_demon
or
bash run.sh
pytorch code
理论参考GeoNet,自己采用pytorch实现。
Note: pytorch>=1.3.1 for torch.det()
运行
python ComputeNormal.py
Compute depth from normal
理论参考GeoNet,自己采用pytorch实现。
Note: pytorch>=1.3.1 for torch.det()
运行
python Normal2Depth.py
[init_depth, normal] -> refined depth
这篇博客介绍了如何利用matlab和pytorch代码计算法线向量,以及从法线向量计算深度。内容包括引用了Data-driven 3d primitives for single image understanding的matlab算法,以及基于GeoNet理论的pytorch实现。注意,pytorch版本需大于等于1.3.1以支持torch.det()函数。
3842

被折叠的 条评论
为什么被折叠?



