(depth, pixel_coords, intrinsics, is_homogeneous=True)
return cam_coords
Transforms coordinates in the pixel frame to the camera frame.

    Args:
      depth: [batch, height, width]
      pixel_coords: homogeneous pixel coordinates [batch, 3, height, width]
      intrinsics: camera intrinsics [batch, 3, 3]
      is_homogeneous: return in homogeneous coordinates
    Returns:
      Coords in the camera frame [batch, 3 (4 if homogeneous), height, width]
Transforms coordinates in the pixel frame to the camera frame.
Transforms coordinates in the pixel frame to the camera frame .
def pixel2cam(depth, pixel_coords, intrinsics, is_homogeneous=True):
    """Transforms coordinates in the pixel frame to the camera frame.

    Args:
      depth: [batch, height, width]
      pixel_coords: homogeneous pixel coordinates [batch, 3, height, width]
      intrinsics: camera intrinsics [batch, 3, 3]
      is_homogeneous: return in homogeneous coordinates
    Returns:
      Coords in the camera frame [batch, 3 (4 if homogeneous), height, width]
    """
    batch, height, width = depth.get_shape().as_list()
    depth = tf.reshape(depth, [batch, 1, -1])
    pixel_coords = tf.reshape(pixel_coords, [batch, 3, -1])
    cam_coords = tf.matmul(tf.matrix_inverse(intrinsics), pixel_coords) * depth
    if is_homogeneous:
        ones = tf.ones([batch, 1, height*width])
        cam_coords = tf.concat([cam_coords, ones], axis=1)
    cam_coords = tf.reshape(cam_coords, [batch, -1, height, width])
    return cam_coords
def pixel2cam ( depth , pixel_coords , intrinsics , is_homogeneous = True ) : batch , height , width = depth . get_shape ( ) . as_list ( ) depth = tf . reshape ( depth , [ batch , 1 , - 1 ] ) pixel_coords = tf . reshape ( pixel_coords , [ batch , 3 , - 1 ] ) cam_coords = tf . matmul ( tf . matrix_inverse ( intrinsics ) , pixel_coords ) * depth if is_homogeneous : ones = tf . ones ( [ batch , 1 , height * width ] ) cam_coords = tf . concat ( [ cam_coords , ones ] , axis = 1 ) cam_coords = tf . reshape ( cam_coords , [ batch , - 1 , height , width ] ) return cam_coords