def depth_to_disparity(self, depth, position):
baseline_distance = self.params.baseline
S, T = lat_long_grid([tf.shape(depth)[1], tf.shape(depth)[2]])
_, T_grids = self.expand_grids(S, T, tf.shape(depth)[0])
if position == "top":
return self.disparity_scale * (np.pi / 2.0 - atan2(baseline_distance * depth, (1.0 + tf.tan(-T_grids) ** 2.0) * (depth ** 2.0) + baseline_distance * depth * tf.tan(-T_grids)))
else:
return self.disparity_scale * (atan2(baseline_distance * depth, (1.0 + tf.tan(-T_grids) ** 2.0) * (depth ** 2.0) - baseline_distance * depth * tf.tan(-T_grids)) - np.pi / 2.0)
评论列表
文章目录