cars.applications.triangulation.triangulation_algo

Preprocessing module: contains functions used for triangulation

Functions

triangulate(→ Dict[str, xarray.Dataset])

This function will perform triangulation from a disparity map

triangulate_matches(geometry_plugin, sensor1, sensor2, ...)

This function will perform triangulation from sift matches

triangulate_sparse_matches(sensor1, sensor2, ...)

Triangulate matches in a metric system

compute_point_cloud(→ xarray.Dataset)

Compute point cloud

Module Contents

cars.applications.triangulation.triangulation_algo.triangulate(geometry_plugin, sensor1, sensor2, geomodel1, geomodel2, grid1, grid2, disp_ref: xarray.Dataset, disp_key: str = cst_disp.MAP) Dict[str, xarray.Dataset][source]

This function will perform triangulation from a disparity map

Parameters:
  • geometry_plugin (AbstractGeometry) – geometry plugin to use

  • sensor1 (str) – path to left sensor image

  • sensor2 (str) – path to right sensor image

  • geomodel1 (dict) – path and attributes for left geomodel

  • geomodel2 (dict) – path and attributes for right geomodel

  • grid1 (CarsDataset) – dataset of the reference image grid file

  • grid2 (CarsDataset) – dataset of the secondary image grid file

  • disp_ref – left to right disparity map dataset

  • im_ref_msk_ds – reference image dataset (image and mask (if indicated by the user) in epipolar geometry)

  • disp_key – disparity key in the dataset usually set to cst_disp.MAP, but can be a disparity interval bound

Returns:

point_cloud as a dictionary of dataset containing:

  • Array with shape (roi_size_x,roi_size_y,3), with last dimension corresponding to longitude, latitude and elevation

  • Array with shape (roi_size_x,roi_size_y) with output mask

  • Array for color (optional): only if color1 is not None

The dictionary keys are :

  • ‘ref’ to retrieve the dataset built from the left to right disparity map

  • ‘sec’ to retrieve the dataset built from the right to left disparity map (if provided in input)

cars.applications.triangulation.triangulation_algo.triangulate_matches(geometry_plugin, sensor1, sensor2, geomodel1, geomodel2, grid1, grid2, matches, interpolation_method=None)[source]

This function will perform triangulation from sift matches

Parameters:
  • geometry_plugin (AbstractGeometry) – geometry plugin to use

  • sensor1 (str) – path to left sensor image

  • sensor2 (str) – path to right sensor image

  • geomodel1 (dict) – path and attributes for left geomodel

  • geomodel2 (dict) – path and attributes for right geomodel

  • grid1 (CarsDataset) – dataset of the reference image grid file

  • grid2 (CarsDataset) – dataset of the secondary image grid file

  • matches – numpy.array of matches of shape (nb_matches, 4)

Returns:

point_cloud as a panda DataFrame containing:

  • Array with shape (nb_matches,1,3), with last dimension corresponding to longitude, latitude and elevation

  • Array with shape (nb_matches,1) with output mask

  • cst.X

  • cst.Y

  • cst.Z

  • corr_mask

  • lon

  • lat

Return type:

pandas.DataFrame

cars.applications.triangulation.triangulation_algo.triangulate_sparse_matches(sensor1, sensor2, geomodel1, geomodel2, interpolated_grid_left, interpolated_grid_right, matches, geometry_plugin, epsg)[source]

Triangulate matches in a metric system

Parameters:
  • sensor_image_right (CarsDataset) – sensor image right

  • sensor_image_left (CarsDataset) – sensor image left

  • grid_left (CarsDataset CarsDataset) – grid left

  • grid_right (CarsDataset) – corrected grid right

  • interpolated_grid_left (shareloc.rectificationGrid) – rectification grid left

  • interpolated_grid_right (shareloc.rectificationGrid) – rectification grid right

  • matches (np.ndarray) – matches

  • geometry_plugin (AbstractGeometry) – geometry plugin to use

  • srtm_dir (str) – srtm directory

  • default_alt (float) – default altitude

  • pair_folder (str) – folder used for current pair

  • epsg (int) – ground epsg

Returns:

disp min and disp max

Return type:

float, float

cars.applications.triangulation.triangulation_algo.compute_point_cloud(geometry_plugin, sensor1, sensor2, geomodel1, geomodel2, grid1, grid2, data: xarray.Dataset, roi_key: str) xarray.Dataset[source]

Compute point cloud

Parameters:
  • geometry_plugin – geometry plugin to use

  • sensor1 – path to left sensor image

  • sensor2 – path to right sensor image

  • geomodel1 – path and attributes for left geomodel

  • geomodel2 – path and attributes for right geomodel

  • grid1 – dataset of the reference image grid file

  • grid2 – dataset of the secondary image grid file

  • data – The reference to disparity map dataset

  • roi_key – roi of the disparity map key (‘roi’ if cropped while calling create_disp_dataset, otherwise ‘roi_with_margins’)

Returns:

the point cloud dataset