cars.applications.triangulation.triangulation_tools

Preprocessing module: contains functions used for triangulation

Module Contents

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

compute_points_cloud(→ xarray.Dataset)

Compute points cloud

add_layer(dataset, layer_name, layer_coords, point_cloud)

Add layer point cloud to point cloud dataset

geoid_offset(points, geoid)

Compute the point cloud height offset from geoid.

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

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_tools.triangulate_matches(geometry_plugin, sensor1, sensor2, geomodel1, geomodel2, grid1, grid2, matches)

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_tools.compute_points_cloud(geometry_plugin, sensor1, sensor2, geomodel1, geomodel2, grid1, grid2, data: xarray.Dataset, roi_key: str) xarray.Dataset

Compute points 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 points cloud dataset

cars.applications.triangulation.triangulation_tools.add_layer(dataset, layer_name, layer_coords, point_cloud)

Add layer point cloud to point cloud dataset

Parameters
  • dataset – input disparity map dataset

  • layer_name – layer key in disparity dataset

  • layer_coords – layer axis name in disparity dataset

  • point_cloud – output point cloud dataset

cars.applications.triangulation.triangulation_tools.geoid_offset(points, geoid)

Compute the point cloud height offset from geoid.

Parameters
  • points (xarray.Dataset) – point cloud data in lat/lon/alt WGS84 (EPSG 4326) coordinates.

  • geoid (xarray.Dataset) – geoid elevation data.

Returns

the same point cloud but using geoid as altimetric reference.

Return type

xarray.Dataset