cars.applications.dense_matching.census_mccnn_sgm

this module contains the dense_matching application class.

Module Contents

Classes

CensusMccnnSgm

Census SGM & MCCNN SGM matching class

Functions

compute_disparity_wrapper(→ Dict[str, ...)

Compute disparity maps from image objects.

class cars.applications.dense_matching.census_mccnn_sgm.CensusMccnnSgm(conf=None)

Bases: cars.applications.dense_matching.dense_matching.DenseMatching

Census SGM & MCCNN SGM matching class

check_conf(conf)

Check configuration

Parameters

conf (dict) – configuration to check

Returns

overloaded configuration

Return type

dict

get_margins_fun(grid_left, disp_range_grid)

Get Margins function that generates margins needed by matching method, to use during resampling

Parameters
  • grid_left – left epipolar grid

  • disp_min_grid – minimum and maximum disparity grid

Returns

function that generates margin for given roi

get_optimal_tile_size(disp_range_grid, max_ram_per_worker)

Get the optimal tile size to use during dense matching.

Parameters
  • disp_range_grid – minimum and maximum disparity grid

  • max_ram_per_worker – maximum ram per worker

Returns

optimal tile size

generate_disparity_grids(sensor_image_right, grid_right, geom_plugin_with_dem_and_geoid, dmin=None, dmax=None, altitude_delta_min=None, altitude_delta_max=None, dem_median=None, dem_min=None, dem_max=None, pair_folder=None)

Generate disparity grids min and max, with given step

global mode: uses dmin and dmax local mode: uses dems

Parameters
  • sensor_image_right (dict) – sensor image right

  • grid_right (CarsDataset) – right epipolar grid

  • geom_plugin_with_dem_and_geoid (GeometryPlugin) – geometry plugin with dem mean used to generate epipolar grids

  • dmin (float) – minimum disparity

  • dmax (float) – maximum disparity

  • altitude_delta_max (int) – Delta max of altitude

  • altitude_delta_min (int) – Delta min of altitude

  • dem_median (str) – path to median dem

  • dem_min (str) – path to minimum dem

  • dem_max (str) – path to maximum dem

  • pair_folder (str) – folder used for current pair

:return disparity grid range, containing grid min and max :rtype: CarsDataset

run(epipolar_images_left, epipolar_images_right, local_tile_optimal_size_fun, orchestrator=None, pair_folder=None, pair_key='PAIR_0', disp_range_grid=None, compute_disparity_masks=False, disp_to_alt_ratio=None)

Run Matching application.

Create CarsDataset filled with xarray.Dataset, corresponding to epipolar disparities, on the same geometry than epipolar_images_left.

Parameters
  • epipolar_images_left (CarsDataset) –

    tiled left epipolar CarsDataset contains:

    • N x M Delayed tiles. Each tile will be a future xarray Dataset containing:

      • data with keys : “im”, “msk”, “color”

      • attrs with keys: “margins” with “disp_min” and “disp_max” “transform”, “crs”, “valid_pixels”, “no_data_mask”, “no_data_img”

    • attributes containing:

      ”largest_epipolar_region”,”opt_epipolar_tile_size”

  • epipolar_images_right (CarsDataset) –

    tiled right epipolar CarsDataset contains:

    • N x M Delayed tiles. Each tile will be a future xarray Dataset containing:

      • data with keys : “im”, “msk”, “color”

      • attrs with keys: “margins” with “disp_min” and “disp_max”

        ”transform”, “crs”, “valid_pixels”, “no_data_mask”, “no_data_img”

    • attributes containing:

      ”largest_epipolar_region”,”opt_epipolar_tile_size”

  • local_tile_optimal_size_fun (func) – function to compute local optimal tile size

  • orchestrator – orchestrator used

  • pair_folder (str) – folder used for current pair

  • pair_key (str) – pair id

  • disp_range_grid (CarsDataset) – minimum and maximum disparity grid

  • disp_to_alt_ratio (float) – disp to alti ratio used for performance map

Returns

disparity map: The CarsDataset contains:

  • N x M Delayed tiles. Each tile will be a future xarray Dataset containing:
    • data with keys : “disp”, “disp_msk”

    • attrs with keys: profile, window, overlaps

  • attributes containing:
    ”largest_epipolar_region”,”opt_epipolar_tile_size”,

    ”disp_min_tiling”, “disp_max_tiling”

Return type

CarsDataset

cars.applications.dense_matching.census_mccnn_sgm.compute_disparity_wrapper(left_image_object: xarray.Dataset, right_image_object: xarray.Dataset, corr_cfg: dict, disp_range_grid, saving_info=None, compute_disparity_masks=False, generate_performance_map=False, perf_ambiguity_threshold=0.6, disp_to_alt_ratio=None, crop_with_range=None) Dict[str, Tuple[xarray.Dataset, xarray.Dataset]]

Compute disparity maps from image objects. This function will be run as a delayed task.

User must provide saving infos to save properly created datasets

Parameters
  • left_image_object

    tiled Left image - dataset with :

    • cst.EPI_IMAGE

    • cst.EPI_MSK (if given)

    • cst.EPI_COLOR (for left, if given)

  • right_image_object (xr.Dataset) – tiled Right image

  • corr_cfg (dict) – Correlator configuration

  • disp_range_grid (np.ndarray) – minimum and maximum disparity grid

  • compute_disparity_masks (bool) – Compute all the disparity pandora masks(disable by default)

  • generate_performance_map (bool) – True if generate performance map

  • perf_ambiguity_threshold (float) – ambiguity threshold used for performance map

  • disp_to_alt_ratio (float) – disp to alti ratio used for performance map

  • crop_with_range (float) – range length to crop disparity range with

Returns

Left to right disparity dataset Returned dataset is composed of :

  • cst_disp.MAP

  • cst_disp.VALID

  • cst.EPI_COLOR