def parse_carla_depth(depth_image):
  """Parse Carla depth image."""
  # 0.9.6: The image codifies the depth in 3 channels of the RGB color space,
  # from less to more significant bytes: R -> G -> B.
  # depth_image is [h, w, 3], last dim is RGB order
  depth_image = depth_image.astype("float32")
  normalized = (depth_image[:, :, 0] + depth_image[:, :, 1]*256 + \
      depth_image[:, :, 2]*256*256) / (256 * 256 * 256 - 1)
  return 1000 * normalized