cars.applications.rasterization.rasterization_algo

This module is responsible for the rasterization step: - it contains all functions related to 3D representation on a 2D raster grid TODO: refactor in several files and remove too-many-lines

Functions

simple_rasterization_dataset_wrapper(→ xarray.Dataset)

Wrapper of simple_rasterization

compute_vector_raster_and_stats(→ Tuple[numpy.ndarray, ...)

Compute vectorized raster and its statistics.

rasterize(→ Union[xarray.Dataset, None])

Rasterize a point cloud with its color bands to a Dataset

Module Contents

cars.applications.rasterization.rasterization_algo.simple_rasterization_dataset_wrapper(cloud: pandas.DataFrame, resolution: float, epsg: int, xstart: float = None, ystart: float = None, xsize: int = None, ysize: int = None, sigma: float = None, radius: int = 1, dsm_no_data: int = np.nan, texture_no_data: int = np.nan, msk_no_data: int = 255, list_computed_layers: List[str] = None, source_pc_names: List[str] = None, performance_map_classes: List[float] = None, cloud_global_id: int = None) xarray.Dataset[source]

Wrapper of simple_rasterization that has xarray.Dataset as inputs and outputs.

Parameters:
  • cloud – cloud to rasterize

  • resolution – Resolution of rasterized cells, expressed in cloud CRS units or None

  • epsg – epsg code for the CRS of the final raster

  • color_list – Additional list of images with bands to rasterize (same size as cloud_list), or None

  • xstart – xstart of the rasterization grid (if None, will be estimated by the function)

  • ystart – ystart of the rasterization grid (if None, will be estimated by the function)

  • xsize – xsize of the rasterization grid (if None, will be estimated by the function)

  • ysize – ysize of the rasterization grid (if None, will be estimated by the function)

  • sigma – sigma for gaussian interpolation. (If None, set to resolution)

  • radius – Radius for hole filling.

  • dsm_no_data – no data value to use in the final raster

  • texture_no_data – no data value to use in the final colored raster

  • msk_no_data – no data value to use in the final mask image

  • list_computed_layers – list of computed output data

  • source_pc_names – list of names of point cloud before merging : name of sensors pair or name of point cloud file

  • performance_map_classes (list or None) – list for step defining border of class

  • cloud_global_id (int) – global id of pair

Returns:

Rasterized cloud

cars.applications.rasterization.rasterization_algo.compute_vector_raster_and_stats(cloud: pandas.DataFrame, x_start: float, y_start: float, x_size: int, y_size: int, resolution: float, sigma: float, radius: int, list_computed_layers: List[str] = None, cloud_global_id: int = None) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, List[str], None | numpy.ndarray | list | dict][source]

Compute vectorized raster and its statistics.

Parameters:
  • cloud – Combined cloud as returned by the create_combined_cloud function

  • x_start – x start of the rasterization grid

  • y_start – y start of the rasterization grid

  • x_size – x size of the rasterization grid

  • y_size – y size of the rasterization grid

  • resolution – Resolution of rasterized cells, expressed in cloud CRS units or None.

  • sigma – Sigma for gaussian interpolation. If None, set to resolution

  • radius – Radius for hole filling.

  • list_computed_layers – list of computed output data

  • cloud_global_id – global id of pair

Returns:

a tuple with rasterization results and statistics.

cars.applications.rasterization.rasterization_algo.rasterize(cloud: pandas.DataFrame, resolution: float, epsg: int, x_start: float, y_start: float, x_size: int, y_size: int, sigma: float = None, radius: int = 1, hgt_no_data: int = -32768, texture_no_data: int = 0, msk_no_data: int = 255, list_computed_layers: List[str] = None, source_pc_names: List[str] = None, performance_map_classes: List[float] = None, cloud_global_id: int = None) xarray.Dataset | None[source]

Rasterize a point cloud with its color bands to a Dataset that also contains quality statistics.

Parameters:
  • cloud – Combined cloud as returned by the create_combined_cloud function

  • resolution – Resolution of rasterized cells, expressed in cloud CRS units or None.

  • epsg – epsg code for the CRS of the final raster

  • x_start – x start of the rasterization grid

  • y_start – y start of the rasterization grid

  • x_size – x size of the rasterization grid

  • y_size – y size of the rasterization grid

  • sigma – sigma for gaussian interpolation. If None, set to resolution

  • radius – Radius for hole filling.

  • hgt_no_data – no data value to use for height

  • texture_no_data – no data value to use for color

  • msk_no_data – no data value to use in the final mask image

  • list_computed_layers – list of computed output data

  • source_pc_names – list of source pc names

  • performance_map_classes (list or None) – list for step defining border of class

  • cloud_global_id – global id of pair

Returns:

Rasterized cloud color and statistics.