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(loader_to_use, configuration, matches)

This function will perform triangulation from sift matches

compute_points_cloud(→ xarray.Dataset)

Compute points cloud

geoid_offset(points, geoid)

Compute the point cloud height offset from geoid.

cars.applications.triangulation.triangulation_tools.triangulate(loader_to_use, configuration, disp_ref: xarray.Dataset, disp_sec: xarray.Dataset = None, im_ref_msk_ds: xarray.Dataset = None, im_sec_msk_ds: xarray.Dataset = None, snap_to_img1: bool = False) Dict[str, xarray.Dataset]

This function will perform triangulation from a disparity map

Parameters
  • loader_to_use (str) – geometry loader to use

  • configuration (StereoConfiguration) – StereoConfiguration

  • disp_ref – left to right disparity map dataset

  • disp_sec – if available, the right to left disparity map dataset

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

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

  • snap_to_img1 – If True, Lines of Sight of img2 are moved so as to cross those of img1

  • snap_to_img1 – bool

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, lattitude 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(loader_to_use, configuration, matches, snap_to_img1=False)

This function will perform triangulation from sift matches

Parameters
  • loader_to_use (str) – geometry loader to use

  • configuration (StereoConfiguration) – StereoConfiguration

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

  • snap_to_img1 – If this is True, Lines of Sight of img2 are moved so as to cross those of img1

  • snap_to_img1 – bool

Returns

point_cloud as a dataset containing:

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

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

Return type

xarray.Dataset

cars.applications.triangulation.triangulation_tools.compute_points_cloud(loader_to_use: str, data: xarray.Dataset, cars_conf, grid1: str, grid2: str, roi_key: str, dataset_msk: xarray.Dataset = None) xarray.Dataset

Compute points cloud

Parameters
  • loader_to_use (str:param loader_to_use: geometru loader to use) – geometru loader to use

  • data – The reference to disparity map dataset

  • cars_conf – cars input configuration dictionary

  • grid1 – path to the reference image grid file

  • grid2 – path to the secondary image grid file

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

  • dataset_msk – dataset with mask information to use

Returns

the points 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