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(→ Dict[str, Tuple[xarray.Dataset, ...)

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(grid_left, disp_min=None, disp_max=None)

Get Margins needed by matching method, to use during resampling

Parameters
  • grid_left – left epipolar grid

  • disp_min – minimum disparity

  • disp_max – maximum disparity

Returns

margins, updated disp_min, updated disp_max

get_optimal_tile_size(disp_min, disp_max, max_ram_per_worker)

Get the optimal tile size to use during dense matching.

Parameters
  • disp_min – minimum disparity

  • disp_max – maximum disparity

  • max_ram_per_worker – maximum ram per worker

Returns

optimal tile size

run(epipolar_images_left, epipolar_images_right, orchestrator=None, pair_folder=None, pair_key='PAIR_0', mask1_ignored_by_corr: List[int] = None, mask2_ignored_by_corr: List[int] = None, mask1_set_to_ref_alt: List[int] = None, mask2_set_to_ref_alt: List[int] = None, disp_min=None, disp_max=None, compute_disparity_masks=False)

Run Matching application.

Create left and right CarsDataset filled with xarray.Dataset , corresponding to epipolar disparities, on the same geometry that epipolar_images_left and epipolar_images_right.

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”

  • orchestrator – orchestrator used

  • pair_folder (str) – folder used for current pair

  • pair_key (str) – pair id

  • mask1_ignored_by_corr (list) – values used in left mask to ignore in correlation

  • mask2_ignored_by_corr (list) – values used in right mask to ignore in correlation

  • mask1_set_to_ref_alt (list) – values used in left mask to altitude to ref

  • mask2_set_to_ref_alt (list) – values used in right mask to altitude to ref

  • disp_min (int) – minimum disparity

  • disp_max (int) – maximum disparity

Returns

left disparity map, right disparity map: Each 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”

Return type

Tuple(CarsDataset, CarsDataset)

cars.applications.dense_matching.census_mccnn_sgm.compute_disparity(left_image_object: xarray.Dataset, right_image_object: xarray.Dataset, corr_cfg: dict, mask1_ignored_by_corr: List[int] = None, mask2_ignored_by_corr: List[int] = None, mask1_set_to_ref_alt: List[int] = None, mask2_set_to_ref_alt: List[int] = None, disp_min=None, disp_max=None, use_sec_disp=False, saving_info_left=None, saving_info_right=None, compute_disparity_masks=False) 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_min (int) – minimum disparity

  • disp_max (int) – maximum disparity

  • use_sec_disp (bool) – Boolean activating the use of the secondary disparity map

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

Returns

Left disparity object, Right disparity object (if exists)

Returned objects are composed of :
  • dataset (None for right object if use_sec_disp not activated) with :

    • cst_disp.MAP

    • cst_disp.VALID

    • cst.EPI_COLOR