def rectilinear_xyz(K, shape, face = "front"):
u, v = tf.meshgrid(tf.linspace(-1.0, 1.0, shape[1]),
tf.linspace(-1.0, 1.0, shape[0]))
# X = (u - c_x) * z / f_x
# Y = (v - c_y) * z / f_y
a = (u - K[2]) / K[0]
b = (v - K[3]) / K[1]
c = tf.ones([shape[1], shape[0]], dtype = tf.float32)
return switch_face(a, b, c, face)
评论列表
文章目录