cars.applications.sparse_matching.sift

this module contains the dense_matching application class.

Module Contents

Classes

Sift

SparseMatching

Functions

compute_matches_wrapper(→ Dict[str, ...)

Compute matches from image objects.

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_matches_filter_knn()

Get matches_filter_knn : number of neighboors used to measure isolation of matches

Returns

matches_filter_knn

get_matches_filter_dev_factor()

Get matches_filter_dev_factor : factor of deviation in the formula to compute threshold of outliers

Returns

matches_filter_dev_factor

get_margins_fun(disp_min=None, disp_max=None)

Get margins function to use in resampling

Parameters
  • disp_min – disp min for info

  • disp_max – disp max for info

Returns

margins function

Return type

function generating xr.Dataset

run(epipolar_images_left, epipolar_images_right, disp_to_alt_ratio, orchestrator=None, pair_folder=None, pair_key='PAIR_0')

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

  • 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

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)

filter_matches(epipolar_matches_left, grid_left, grid_right, 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 containing “disp_lower_bound”, “disp_upper_bound”, “elevation_delta_lower_bound”,”elevation_delta_upper_bound”

  • grid_left (CarsDataset) – left epipolar grid

  • grid_right (CarsDataset) – right epipolar grid

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

:return filtered matches :rtype: np.ndarray

cars.applications.sparse_matching.sift.compute_matches_wrapper(left_image_object: xarray.Dataset, right_image_object: xarray.Dataset, matching_threshold=None, n_octave=None, n_scale_per_octave=None, peak_threshold=None, edge_threshold=None, magnification=None, backmatching=None, disp_lower_bound=None, disp_upper_bound=None, saving_info_left=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