def fast_rotate(input_image, dx = 0, dy = 0):
# Basic rotations (constant disparities) for equirectangular
# images. For image augmentations (y-axis rotations), this method is preferable compared
# to the more general rotation function.
height = tf.shape(input_image)[0]
width = tf.shape(input_image)[1]
# Shift coordinate grid for inverse warp.
ix, iy = tf.meshgrid(tf.range(width), tf.range(height))
ox = tf.mod(ix - dx, width)
oy = tf.mod(iy - dy, height)
indices = tf.stack([oy, ox], 2)
# Perform exact sampling (as we are using integer coordinates).
return tf.gather_nd(input_image, indices)
# Project equirectangular image onto a cube face.
评论列表
文章目录