cars.applications.dem_generation.dem_generation_wrappers

this module contains tools for the dem generation

Functions

fit_initial_elevation_on_dem_median(dem_to_fit_path, ...)

Coregistrates the two DEMs given then saves the result.

add_margin(bbox[, ratio])

Add margin to a bounding box

compute_stats(diff)

Compute and display statistics of difference between two DEM :

edit_transform(input_dem[, resolution, transform])

Change transform of an image

reverse_dem(input_dem)

Compute the opposite of a DEM :

downsample_dem(input_dem, scale, interpolator[, ...])

Downsample median DEM with median resampling

modify_terrain_bounds(terrain_bounds, linear_margin, ...)

Modify the terrain bounds

reproject_dem(dsm_file_name, epsg_out, out_file_name)

Reproject the DEM

Module Contents

cars.applications.dem_generation.dem_generation_wrappers.fit_initial_elevation_on_dem_median(dem_to_fit_path: str, dem_ref_path: str, dem_out_path: str)[source]

Coregistrates the two DEMs given then saves the result. The initial elevation will be cropped to reduce computation costs. Returns the transformation applied.

Parameters:
  • dem_to_fit_path (str) – Path to the dem to be fitted

  • dem_ref_path (str) – Path to the dem to fit onto

  • dem_out_path (str) – Path to save the resulting dem into

Returns:

coregistration transformation applied

Return type:

dict

cars.applications.dem_generation.dem_generation_wrappers.add_margin(bbox, ratio=1)[source]

Add margin to a bounding box :param bbox: input bounding box :type bbox: rasterio.coords.BoundingBox :param ratio: factor of bbox size to add to each side of bbox :type ratio: float

Returns:

bounding box with margins

Return type:

rasterio.coords.BoundingBox

cars.applications.dem_generation.dem_generation_wrappers.compute_stats(diff)[source]

Compute and display statistics of difference between two DEM : Minimum, median, percentiles and maximum

Parameters:

diff (numpy.array) – altimetric difference between two DEM

cars.applications.dem_generation.dem_generation_wrappers.edit_transform(input_dem, resolution=None, transform=None)[source]

Change transform of an image :param input_res: path of image :type input_dem: str :param resolution: image resolution for new transform to apply :type resolution: float :param transform: new transform to apply if resolution is not given :type transform: affine.Affine

cars.applications.dem_generation.dem_generation_wrappers.reverse_dem(input_dem)[source]

Compute the opposite of a DEM : Altitudes sign is changed

Parameters:

input_dem (str) – path of DEM to reverse

cars.applications.dem_generation.dem_generation_wrappers.downsample_dem(input_dem, scale, interpolator, median_filter_size=None, default_alt=0)[source]

Downsample median DEM with median resampling

Parameters:

input_dem (str) – path of DEM to downsample (only one band)

cars.applications.dem_generation.dem_generation_wrappers.modify_terrain_bounds(terrain_bounds, linear_margin, constant_margin, epsg)[source]

Modify the terrain bounds

Parameters:
  • terrain_bounds (list) – Input region of interest for DEM

  • margin (int) – Margin of the output ROI in meters

cars.applications.dem_generation.dem_generation_wrappers.reproject_dem(dsm_file_name, epsg_out, out_file_name)[source]

Reproject the DEM

Parameters:
  • dsm_file_name (str) – the path to dsm

  • epsg_out (int) – the epsg code

  • out_file_name (str) – the out path file