cars.applications.rasterization.rasterization_tools
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
Module Contents
Functions
|
Compute xstart, ystart, xsize and ysize |
|
Wrapper of simple_rasterization |
|
Compute the x and y values as 1d arrays |
|
Compute vectorized raster and its statistics. |
|
Check if the list contains substring |
|
Create final raster xarray dataset |
|
Rasterize a point cloud with its color bands to a Dataset |
- cars.applications.rasterization.rasterization_tools.compute_xy_starts_and_sizes(resolution: float, cloud: pandas.DataFrame) Tuple[float, float, int, int]
Compute xstart, ystart, xsize and ysize of the rasterization grid from a set of points
- Parameters
resolution – Resolution of rasterized cells, expressed in cloud CRS units
cloud – set of points as returned by the create_combined_cloud function
- Returns
a tuple (xstart, ystart, xsize, ysize)
- cars.applications.rasterization.rasterization_tools.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, color_no_data: int = np.nan, msk_no_data: int = 65535, list_computed_layers: List[str] = None) xarray.Dataset
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
color_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
- Returns
Rasterized cloud
- cars.applications.rasterization.rasterization_tools.compute_values_1d(x_start: float, y_start: float, x_size: int, y_size: int, resolution: float) Tuple[numpy.ndarray, numpy.ndarray]
Compute the x and y values as 1d arrays
- Parameters
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, in cloud CRS units or None.
- Returns
a tuple composed of the x and y 1d arrays
- cars.applications.rasterization.rasterization_tools.compute_vector_raster_and_stats(cloud: pandas.DataFrame, data_valid: numpy.ndarray, x_start: float, y_start: float, x_size: int, y_size: int, resolution: float, sigma: float, radius: int, list_computed_layers: List[str] = None) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, List[str], Union[None, numpy.ndarray]]
Compute vectorized raster and its statistics.
- Parameters
cloud – Combined cloud as returned by the create_combined_cloud function
data_valid – mask of points which are not on the border of its original epipolar image. To compute a cell it has to have at least one data valid, for which case it is considered that no contributing points from other neighbor tiles are missing.
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
- Returns
a tuple with rasterization results and statistics.
- cars.applications.rasterization.rasterization_tools.substring_in_list(src_list, substring)
Check if the list contains substring
- cars.applications.rasterization.rasterization_tools.create_raster_dataset(raster: numpy.ndarray, x_start: float, y_start: float, x_size: int, y_size: int, resolution: float, hgt_no_data: int, color_no_data: int, msk_no_data: int, epsg: int, mean: numpy.ndarray, stdev: numpy.ndarray, n_pts: numpy.ndarray, n_in_cell: numpy.ndarray, msk: numpy.ndarray = None, classif: numpy.ndarray = None, band_classif: List[str] = None, confidences: numpy.ndarray = None) xarray.Dataset
Create final raster xarray dataset
- Parameters
raster – height and colors
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.
hgt_no_data – no data value to use for height
color_no_data – no data value to use for color
msk_no_data – no data value to use for mask and classif
epsg – epsg code for the CRS of the final raster
mean – mean of height and colors
stdev – standard deviation of height and colors
n_pts – number of points that are stricty in a cell
n_in_cell – number of points which contribute to a cell
msk – raster msk
classif – raster classif
confidence_from_ambiguity – raster msk
- Returns
the raster xarray dataset
- cars.applications.rasterization.rasterization_tools.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, color_no_data: int = 0, msk_no_data: int = 65535, list_computed_layers: List[str] = None) Union[xarray.Dataset, None]
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
color_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
- Returns
Rasterized cloud color and statistics.