l5kit.rasterization.satellite_image module

l5kit.rasterization.satellite_image.get_sat_image_crop(sat_image: numpy.ndarray, crop_size: Union[Tuple[int, int], numpy.ndarray], sat_pixel_translation: numpy.ndarray, yaw: Optional[float] = None) numpy.ndarray

Crops input satellite such that sat_pixel_translation is centered in the image.

Parameters
  • sat_image (np.ndarray) – satellite image

  • crop_size (Union[Tuple[int, int], np.ndarray]) – size of desired crop in pixels

  • sat_pixel_translation (np.ndarray) – 2D or 3D vector where to center the cropped image in pixels.

Keyword Arguments

yaw (Optional[float]) – yaw in radians, None or 0 means no rotation is applied to the output image. default: {None})

Returns

a crop of input sat_image

Return type

(np.ndarray)

l5kit.rasterization.satellite_image.get_sat_image_crop_scaled(sat_image: numpy.ndarray, crop_size: Union[Tuple[int, int], numpy.ndarray], sat_pixel_translation: numpy.ndarray, yaw: Optional[float] = None, sat_pixel_scale: float = 1.0, pixel_size: float = 1.0, interpolation: int = 1) numpy.ndarray
Calls get_sat_image_crop (see that function’s docs for further details), and rescales taking

into account a desired pixel size.

Example

Desired crop_size is 200x200, and pixel_size is 0.5: we want an image that corresponds to 100x100 meters. This means it extracts a 33x33 image and scales it up to 200x200.

Parameters
  • sat_image (np.ndarray) – satellite image

  • crop_size (Union[Tuple[int, int], np.ndarray]) – size of desired crop in pixels

  • sat_pixel_translation (np.ndarray) – 2D or 3D vector where to center the cropped image in pixels.

Keyword Arguments
  • yaw (Optional[float]) – yaw in radians, 0 means no rotation is applied, which generally means up is North. default: {None})

  • sat_pixel_scale (float) – A sat_pixel_scale of 3.0 would means that every pixel in the sat

  • (default (image corresponds to 3m in the real world.) – {1.0})

  • pixel_size (float) – [description] (default: {1.0})

  • interpolation (int) – [description] (default: {cv2.INTER_LINEAR})

Returns

a crop of input sat_image

Return type

(np.ndarray)

l5kit.rasterization.satellite_image.get_sat_image_crop_scaled_from_ecef(sat_image: numpy.ndarray, crop_size: Union[Tuple[int, int], numpy.ndarray], ecef_translation: numpy.ndarray, ecef_to_sat: numpy.ndarray, **kwargs: Any) numpy.ndarray

Utility function, calls get_sat_image_crop_scaled, see that function for more details on additional keyword arguments (such as yaw).

Parameters
  • sat_image (np.ndarray) – satellite image

  • crop_size (Union[Tuple[int, int], np.ndarray]) – size of desired crop in pixels

  • ecef_translation (np.ndarray) – 2D or 3D vector where to center the cropped image

  • ecef_to_sat (np.ndarray) – transform from ECEF to satellite image space

Returns

np.ndarray – a crop of satellite_image