def backproject_rectilinear(depth, K, shape, face):
u, v = tf.meshgrid(tf.linspace(-1.0, 1.0, shape[2]),
tf.linspace(-1.0, 1.0, shape[1]))
u = tf.expand_dims(tf.tile(tf.expand_dims(u, 0), [shape[0], 1, 1]), 3)
v = tf.expand_dims(tf.tile(tf.expand_dims(v, 0), [shape[0], 1, 1]), 3)
A = (u - K[2]) * depth / K[0]
B = (v - K[3]) * depth / K[1]
C = depth
x, y, z = switch_face(A, B, C, face)
return tf.sqrt(x ** 2.0 + z ** 2.0)
评论列表
文章目录