cars.applications.sparse_matching.sparse_matching_tools

Sparse matching Sift module: contains sift sparse matching method

Module Contents

Functions

dataset_matching(ds1, ds2[, matching_threshold, ...])

Compute sift matches between two datasets

remove_epipolar_outliers(matches[, percent])

This function will filter the match vector

compute_disparity_range(matches[, percent])

This function will compute the disparity range

compute_disp_min_disp_max(sensor_image_right, ...[, ...])

Compute disp min and disp max from triangulated and filtered matches

cars.applications.sparse_matching.sparse_matching_tools.dataset_matching(ds1, ds2, matching_threshold=0.6, n_octave=8, n_scale_per_octave=3, dog_threshold=20, edge_threshold=5, magnification=2.0, backmatching=True)

Compute sift matches between two datasets produced by stereo.epipolar_rectify_images

Parameters
  • ds1 (xarray.Dataset as produced by stereo.epipolar_rectify_images) – Left image dataset

  • ds2 (xarray.Dataset as produced by stereo.epipolar_rectify_images) – Right image dataset

  • threshold (float) – Threshold for matches

  • backmatching (bool) – Also check that right vs. left gives same match

Returns

matches

Return type

numpy buffer of shape (nb_matches,4)

cars.applications.sparse_matching.sparse_matching_tools.remove_epipolar_outliers(matches, percent=0.1)

This function will filter the match vector according to a quantile of epipolar error used for testing compute_disparity_range sparse method

Parameters
  • matches (numpy array) – the [4,N] matches array

  • percent (float) – the quantile to remove at each extrema

Returns

the filtered match array

Return type

numpy array

cars.applications.sparse_matching.sparse_matching_tools.compute_disparity_range(matches, percent=0.1)

This function will compute the disparity range from matches by filtering percent outliers

Parameters
  • matches (numpy array) – the [4,N] matches array

  • percent (float) – the quantile to remove at each extrema (in %)

Returns

the disparity range

Return type

float, float

cars.applications.sparse_matching.sparse_matching_tools.compute_disp_min_disp_max(sensor_image_right, sensor_image_left, grid_left, corrected_grid_right, grid_right, matches, orchestrator, geometry_loader, srtm_dir, default_alt, pair_folder='', disp_margin=0.1, pair_key=None, disp_to_alt_ratio=None, save_matches=False)

Compute disp min and disp max from triangulated and filtered matches

Parameters
  • sensor_image_right (CarsDataset) – sensor image right

  • sensor_image_left (CarsDataset) – sensor image left

  • grid_left (CarsDataset CarsDataset) – grid left

  • corrected_grid_right (CarsDataset) – corrected grid right

  • grid_right (CarsDataset) – uncorrected grid right

  • matches (np.ndarray) – matches

  • orchestrator (Orchestrator) – orchestrator used

  • geometry_loader (str) – geometry loader to use

  • srtm_dir (str) – srtm directory

  • default_alt (float) – default altitude

  • pair_folder (str) – folder used for current pair

  • disp_margin (float) – disparity margin

  • disp_to_alt_ratio (float) – used for logging info

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

Returns

disp min and disp max

Return type

float, float