cars.core.preprocessing

Preprocessing contains function used in pipelines

Module Contents

Functions

compute_terrain_bbox(srtm_dir, default_alt, geoid, ...)

Compute terrain bounding box of current pair

compute_roi_poly(input_roi, epsg)

Compute roi polygon from input roi

compute_epsg(sensor_image_left, sensor_image_right, ...)

Compute epsg to use

compute_terrain_bounds(list_of_terrain_roi[, ...])

Compute Terrain bounds of merged pairs

create_former_cars_post_prepare_configuration(...[, ...])

Create post prepare configuration used in former version of CARS

create_former_cars_conf(sensor_image_left, ...[, ...])

Create input configuration used in former version of CARS

Attributes

PREPROCESSING_TAG

LEFT_ENVELOPE_TAG

RIGHT_ENVELOPE_TAG

ENVELOPES_INTERSECTION_TAG

ENVELOPES_INTERSECTION_BB_TAG

cars.core.preprocessing.PREPROCESSING_TAG = 'pair_preprocessing'
cars.core.preprocessing.LEFT_ENVELOPE_TAG = 'left_envelope'
cars.core.preprocessing.RIGHT_ENVELOPE_TAG = 'right_envelope'
cars.core.preprocessing.ENVELOPES_INTERSECTION_TAG = 'envelopes_intersection'
cars.core.preprocessing.ENVELOPES_INTERSECTION_BB_TAG = 'envelopes_intersection_bounding_box'
cars.core.preprocessing.compute_terrain_bbox(srtm_dir, default_alt, geoid, sensor_image_left, sensor_image_right, epipolar_image_left, grid_left, grid_right, epsg, geometry_loader_to_use, disp_min=-10, disp_max=10, resolution=0.5, roi_poly=None, pair_key='PAIR_0', pair_folder=None, orchestrator=None, check_inputs=False)

Compute terrain bounding box of current pair

Parameters
  • srtm_dir (str) – srtm directory

  • default_alt (int) – default altitude

  • geoid (str) – geoid path

  • sensor_image_left (dict) – left image Dict Must contain keys : “image”, “color”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

  • sensor_image_right (dict) – right image Dict Must contain keys : “image”, “color”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

  • grid_left (CarsDataset) –

    left grid. Grid CarsDataset contains :

    • A single tile stored in [0,0], containing a (N, M, 2) shape array in xarray Dataset

    • Attributes containing: “grid_spacing”, “grid_origin”, “epipolar_size_x”, “epipolar_size_y”, “epipolar_origin_x”, “epipolar_origin_y”, “epipolar_spacing_x”, “epipolar_spacing”, “disp_to_alt_ratio”,

  • grid_right (CarsDataset) –

    right grid. Grid CarsDataset contains :

    • A single tile stored in [0,0], containing a (N, M, 2) shape array in xarray Dataset

    • Attributes containing: “grid_spacing”, “grid_origin”, “epipolar_size_x”, “epipolar_size_y”, “epipolar_origin_x”, “epipolar_origin_y”, “epipolar_spacing_x”, “epipolar_spacing”, “disp_to_alt_ratio”,

  • epsg (str) – epsg to use

  • geometry_loader_to_use (str) – geometry loader to use

  • disp_min (int) – minimum disparity

  • disp_max (int) – maximum disparity

  • resolution (float) – resolution

  • roi_poly (Polygon) – roi polygon

  • pair_key (str) – pair key id

  • pair_folder (str) – pair folder to save data to

  • orchestrator (Orchestrator) – orchestrator

  • check_inputs (bool) – true if user wants to check inputs

Returns

former post prepare configuration

Return type

dict

cars.core.preprocessing.compute_roi_poly(input_roi, epsg)

Compute roi polygon from input roi

Parameters
  • input_roi (list[int, int, int ,int], str) – [bounds], roi_epsg

  • epsg (str) – epsg to use

Returns

polygon of roi with right epsg

Return type

Polygon

cars.core.preprocessing.compute_epsg(sensor_image_left, sensor_image_right, grid_left, grid_right, geometry_loader_to_use, orchestrator=None, pair_folder=None, srtm_dir=None, default_alt=None, disp_min=-10, disp_max=10)

Compute epsg to use

Parameters
  • sensor_image_left (dict) – left image Dict Must contain keys : “image”, “color”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

  • sensor_image_right (dict) – right image Dict Must contain keys : “image”, “color”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

  • grid_left (CarsDataset) –

    left grid. Grid CarsDataset contains :

    • A single tile stored in [0,0], containing a (N, M, 2) shape array in xarray Dataset

    • Attributes containing: “grid_spacing”, “grid_origin”, “epipolar_size_x”, “epipolar_size_y”, “epipolar_origin_x”, “epipolar_origin_y”, “epipolar_spacing_x”, “epipolar_spacing”, “disp_to_alt_ratio”,

  • grid_right (CarsDataset) –

    right grid. Grid CarsDataset contains :

    • A single tile stored in [0,0], containing a (N, M, 2) shape array in xarray Dataset

    • Attributes containing: “grid_spacing”, “grid_origin”, “epipolar_size_x”, “epipolar_size_y”, “epipolar_origin_x”, “epipolar_origin_y”, “epipolar_spacing_x”, “epipolar_spacing”, “disp_to_alt_ratio”,

  • geometry_loader_to_use (str) – geometry loader to use

  • orchestrator (Orchestrator) – orchestrator

  • pair_folder (str) – pair folder to save data to

  • srtm_dir (str) – srtm directory

  • default_alt (int) – default altitude

  • disp_min (int) – minimum disparity

  • disp_max (int) – maximum disparity

Returns

epsg

Return type

str

cars.core.preprocessing.compute_terrain_bounds(list_of_terrain_roi, roi_poly=None, resolution=0.5)

Compute Terrain bounds of merged pairs

Parameters
  • list_of_terrain_roi (list) – list of terrain roi list of (terrain bbox, terrain epi_tile_size)

  • roi_poly (Polygon) – terrain roi of given roi

  • resolution (float) – list of terrain roi

Returns

bounds, optimal_terrain_tile_width_average

cars.core.preprocessing.create_former_cars_post_prepare_configuration(sensor_image_left, sensor_image_right, grid_left, grid_right, pair_folder, uncorrected_grid_right=None, srtm_dir=None, default_alt=0, disp_min=None, disp_max=None)

Create post prepare configuration used in former version of CARS

Parameters
  • sensor_image_left (dict) – left image Dict Must contain keys : “image”, “color”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

  • sensor_image_right (dict) – right image Dict Must contain keys : “image”, “color”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

  • grid_left (CarsDataset) –

    left grid. Grid CarsDataset contains :

    • A single tile stored in [0,0], containing a (N, M, 2) shape array in xarray Dataset

    • Attributes containing: “grid_spacing”, “grid_origin”, “epipolar_size_x”, “epipolar_size_y”, “epipolar_origin_x”, “epipolar_origin_y”, “epipolar_spacing_x”, “epipolar_spacing”, “disp_to_alt_ratio”,

  • grid_right (CarsDataset) –

    right grid. Grid CarsDataset contains :

    • A single tile stored in [0,0], containing a (N, M, 2) shape array in xarray Dataset

    • Attributes containing: “grid_spacing”, “grid_origin”, “epipolar_size_x”, “epipolar_size_y”, “epipolar_origin_x”, “epipolar_origin_y”, “epipolar_spacing_x”, “epipolar_spacing”, “disp_to_alt_ratio”,

  • pair_folder (str) – pair folder to save data to

  • uncorrected_grid_right (CarsDataset) – uncorrected right grid

  • srtm_dir (str) – srtm directory

  • default_alt (int) – default altitude

  • disp_min (int) – minimum disparity

  • disp_max (int) – maximum disparity

Returns

former post prepare configuration

Return type

dict

cars.core.preprocessing.create_former_cars_conf(sensor_image_left, sensor_image_right, srtm_dir=None, default_alt=0)

Create input configuration used in former version of CARS

Parameters
  • sensor_image_left (dict) – left image Dict Must contain keys : “image”, “color”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

  • sensor_image_right (dict) – right image Dict Must contain keys : “image”, “color”, “geomodel”, “no_data”, “mask”. Paths must be absolutes

  • srtm_dir (str) – srtm directory

  • default_alt (int) – default altitude

Returns

former input configuration

Return type

dict