cars.applications.sparse_matching.sift

this module contains the dense_matching application class.

Module Contents

Classes

Sift

SparseMatching

Functions

compute_matches(→ Dict[str, Tuple[xarray.Dataset, ...)

Compute matches from image objects.

merge_matches(list_of_matches[, saving_info_left])

Concatenate matches

class cars.applications.sparse_matching.sift.Sift(conf=None)

Bases: cars.applications.sparse_matching.sparse_matching.SparseMatching

SparseMatching

check_conf(conf)

Check configuration

Parameters

conf (dict) – configuration to check

Returns

overloaded configuration

Return type

dict

get_save_matches()

Get save_matches parameter

Returns

true is save_matches activated

Return type

bool

get_disparity_margin()

Get disparity margin corresponding to sparse matches

Returns

margin in percent

get_disp_out_reject_percent()

Get disparity_outliers_rejection_percent corresponding to outliers to reject

Returns

margin disparity_outliers_rejection_percent percent

get_margins()

Get margins to use in resampling

Returns

margins

Return type

xr.Dataset

run(epipolar_images_left, epipolar_images_right, disp_to_alt_ratio, orchestrator=None, pair_folder=None, pair_key='PAIR_0', mask1_ignored_by_sift: List[int] = None, mask2_ignored_by_sift: List[int] = None)

Run Matching application.

Create left and right CarsDataset filled with pandas.DataFrame , corresponding to epipolar 2D 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_regions_grid”

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

  • 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

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

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

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 contraining “disp_lower_bound”, “disp_upper_bound”, “elevation_delta_lower_bound”,”elevation_delta_upper_bound”

Return type

Tupple(CarsDataset, CarsDataset)

filter_matches(epipolar_matches_left, orchestrator=None, pair_key='pair_0', pair_folder=None, save_matches=False)

Transform matches CarsDataset to numpy matches, and filters matches

Parameters
  • cars_orchestrator – orchestrator

  • epipolar_matches_left (CarsDataset) –

    matches. CarsDataset contains:

    • N x M Delayed tiles Each tile will be a future pandas DataFrame containing:

      • data : (L, 4) shape matches

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

  • save_matches (bool) – true is matches needs to be saved

:return filtered matches :rtype: np.ndarray

cars.applications.sparse_matching.sift.compute_matches(left_image_object: xarray.Dataset, right_image_object: xarray.Dataset, mask1_ignored_by_sift: List[int] = None, mask2_ignored_by_sift: List[int] = None, matching_threshold=None, n_octave=None, n_scale_per_octave=None, dog_threshold=None, edge_threshold=None, magnification=None, backmatching=None, disp_lower_bound=None, disp_upper_bound=None) Dict[str, Tuple[xarray.Dataset, xarray.Dataset]]

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_COLOR (for left, if given)

  • right_image_object (xr.Dataset) – tiled Right image

Returns

Left matches object, Right matches object (if exists)

Returned objects are composed of :

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

cars.applications.sparse_matching.sift.merge_matches(list_of_matches, saving_info_left=None)

Concatenate matches

Parameters

list_of_matches (list(pandas.DataFrame)) – list of matches