cars.applications.triangulation.triangulation_tools
Preprocessing module: contains functions used for triangulation
Module Contents
Functions
|
This function will perform triangulation from a disparity map |
|
This function will perform triangulation from sift matches |
|
Compute point cloud |
|
Add layer point cloud to point cloud dataset |
|
terrain to index conversion |
|
Compute the point cloud height offset from geoid. |
|
generate the point cloud CSV and LAZ filenames of a given tile from its |
- 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_point_cloud(geometry_plugin, sensor1, sensor2, geomodel1, geomodel2, grid1, grid2, data: xarray.Dataset, roi_key: str) xarray.Dataset
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
- 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.interpolate_geoid_height(geoid_filename, positions, interpolation_method='linear')
terrain to index conversion retrieve geoid height above ellispoid This is a modified version of the Shareloc interpolate_geoid_height function that supports Nan positions (return Nan)
- Parameters
geoid_filename (str) – geoid_filename
positions (2D numpy array: (number of points,[long coord, lat coord])) – geodetic coordinates
interpolation_method (str) – default is ‘linear’ (interpn parameter)
- Returns
geoid height
- Return type
1 numpy array (number of points)
- cars.applications.triangulation.triangulation_tools.geoid_offset(points, geoid_path)
Compute the point cloud height offset from geoid.
- Parameters
points (xarray.Dataset or pandas.DataFrame) – point cloud data in lat/lon/alt WGS84 (EPSG 4326) coordinates.
geoid_path (string) – path to input geoid file on disk
- Returns
the same point cloud but using geoid as altimetric reference.
- Return type
xarray.Dataset or pandas.DataFrame
- cars.applications.triangulation.triangulation_tools.generate_point_cloud_file_names(csv_dir: str, laz_dir: str, row: int, col: int, index: dict = None, pair_key: str = 'PAIR_0')
generate the point cloud CSV and LAZ filenames of a given tile from its corresponding row and col. Optionally update the index, if provided.
- Parameters
csv_dir (str) – target directory for csv files, If None no csv filenames will be generated
laz_dir (str) – target directory for laz files, If None no laz filenames will be generated
row (int) – row index of the tile
col (int) – col index of the tile
index (dict) – product index to update with the filename
pair_key (str) – current product key (used in index), if a list is given a filename will be added to the index for each element of the list