cars.applications.sparse_matching.basic_sparse_matching_app

this module contains the basic sparse matching application class.

Classes

BasicSparseMatchingApplication

SparseMatching

Functions

compute_matches_wrapper(sparse_matching_method, ...[, ...])

Compute matches from image objects.

Module Contents

class cars.applications.sparse_matching.basic_sparse_matching_app.BasicSparseMatchingApplication(conf=None)[source]

Bases: cars.applications.sparse_matching.abstract_sparse_matching_app.SparseMatching

SparseMatching

elevation_delta_lower_bound = None
elevation_delta_upper_bound = None
tile_margin = 10
epipolar_error_upper_bound = 10.0
epipolar_error_maximum_bias = 50.0
minimum_nb_matches = 90
decimation_factor = 30
save_intermediate_data = False
disparity_bounds_estimation
orchestrator = None
check_conf(conf)[source]

Merge user configuration with default values and validate schema. Extra keys in conf are preserved and ignored during schema validation.

Parameters:

conf (dict) – configuration to check

Returns:

overloaded configuration

Return type:

dict

get_required_bands()[source]

Get bands required by this application

Returns:

required bands for left and right image

Return type:

dict

get_margins_strip_fun(disp_min=None, disp_max=None, method='sift')[source]

Get margins function to use in resampling

Parameters:
  • disp_min – disp min for info

  • disp_max – disp max for info

  • method – method for the margins

Returns:

margins function

Return type:

function generating xr.Dataset

get_margins_tile_fun(grid_left, disp_range_grid, method='sift')[source]

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

Parameters:
  • grid_left (dict) – left epipolar grid

  • disp_range_grid – minimum and maximum disparity grid

Returns:

function that generates margin for given roi

filter_matches(epipolar_matches_left, grid_left, grid_right, geom_plugin, orchestrator=None, pair_key='pair_0', pair_folder=None, save_matches=False)[source]

Transform matches CarsDataset to numpy matches, and filters matches

check_conf_disparity_bounds_estimation(conf)[source]

Validate and complete disparity bounds estimation parameters.

run(epipolar_image_left, epipolar_image_right, disp_to_alt_ratio, orchestrator=None, pair_folder=None, pair_key='PAIR_0', classif_bands_to_mask=None)[source]

Run Matching application.

Create left and right CarsDataset filled with pandas.DataFrame , corresponding to epipolar 2D disparities, on the same geometry that epipolar_image_left and epipolar_image_right.

Parameters:
  • epipolar_image_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”, “texture”

      • 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_image_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”, “texture”

      • 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”

  • disp_to_alt_ratio (float) – disp to alti ratio

  • orchestrator – orchestrator used

  • pair_folder (str) – folder used for current pair

  • pair_key (str) – pair key id

  • classif_bands_to_mask (list of str / int) – bands from classif to mask

Return left matches, right matches. Each CarsDataset contains:
  • N x M Delayed tiles Each tile will be a future pandas DataFrame containing:
    • data : (L, 4) shape matches

  • attributes containing “disp_lower_bound”, “disp_upper_bound”, “elevation_delta_lower_bound”,”elevation_delta_upper_bound”

Return type:

Tuple(CarsDataset, CarsDataset)

cars.applications.sparse_matching.basic_sparse_matching_app.compute_matches_wrapper(sparse_matching_method, left_image_object, right_image_object, disp_lower_bound=None, disp_upper_bound=None, saving_info_left=None, classif_bands_to_mask=None)[source]

Compute matches 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_TEXTURE (for left, if given)

  • right_image_object (xr.Dataset) – tiled Right image

  • classif_bands_to_mask (list of str / int) – bands from classif to mask

Returns:

Left matches object, Right matches object (if exists)

Returned objects are composed of :

  • dataframe (None for right object) with :
    • TODO