cars.applications.triangulation.pc_transform
This module is responsible for the transition between triangulation and rasterization steps
Functions
|
Delete masked points with terrain tile mask |
|
Compute terrain tile msk bounds |
|
Create point cloud index from cloud list keys and color inputs |
|
Add color information for a current cloud_list item |
|
Get color type of the tiles and if the same type. |
|
Filter all points of the cloud DataFrame |
Combine a list of clouds (and their colors) into a pandas dataframe |
Module Contents
- cars.applications.triangulation.pc_transform.filter_cloud_with_mask(crop_cloud, crop_terrain_tile_data_msk)[source]
Delete masked points with terrain tile mask
- Parameters:
crop_cloud – the point cloud
crop_terrain_tile_data_msk – terrain tile mask
- cars.applications.triangulation.pc_transform.compute_terrain_msk(dsm_epsg, xmin, xmax, ymin, ymax, margin, epsg, point_cloud, full_x, full_y)[source]
Compute terrain tile msk bounds
If the point clouds are not in the same referential as the roi, it is converted using the dsm_epsg
- Parameters:
dsm_epsg – epsg code for the CRS of the final output raster
xmin – xmin of the rasterization grid (if None, the whole clouds are combined)
xmax – xmax of the rasterization grid (if None, the whole clouds are combined)
ymin – ymin of the rasterization grid (if None, the whole clouds are combined)
ymax – ymax of the rasterization grid (if None, the whole clouds are combined)
margin – Margin added for each tile, in meter or degree. (default value: 0)
epsg – epsg code of the input cloud
point_cloud – the point cloud
full_x – point_cloud[X]
full_y – point_cloud[Y]
- cars.applications.triangulation.pc_transform.create_point_cloud_index(cloud_sample)[source]
Create point cloud index from cloud list keys and color inputs
- cars.applications.triangulation.pc_transform.add_information_to_cloud(input_cloud, cloud_indexes, bbox, target_cloud, input_array, output_column)[source]
Add color information for a current cloud_list item
- Parameters:
cloud (xr.Dataset) – source point cloud dataset
cloud_indexes (list[str]) – list of band data to extract
bbox (list[int]) – bbox of interest
crop_cloud (np.array[columns, points]) – target flatten point cloud
input_array (str) – index of input to extract from cloud
output_column – index of crop_cloud to fill
- cars.applications.triangulation.pc_transform.get_color_type(clouds)[source]
Get color type of the tiles and if the same type.
- Parameters:
cloud_list (xarray Dataset) – list of clouds
- Returns:
color type of the tiles list
- Return type:
str
- cars.applications.triangulation.pc_transform.filter_cloud(cloud: pandas.DataFrame, index_elt_to_remove: List[int], filtered_elt_pos: bool = False) Tuple[pandas.DataFrame, None | pandas.DataFrame][source]
Filter all points of the cloud DataFrame which index is in the index_elt_to_remove list.
If filtered_elt_pos is set to True, the information of the removed elements positions in their original epipolar images are returned.
To do so the cloud DataFrame has to be build with the ‘with_coords’ option activated.
- Parameters:
cloud – combined cloud as returned by the create_combined_cloud function
index_elt_to_remove – indexes of lines to filter in the cloud DataFrame
filtered_elt_pos – if filtered_elt_pos is set to True, the removed points positions in their original epipolar images are returned, otherwise it is set to None
- Returns:
Tuple composed of the filtered cloud DataFrame and the filtered elements epipolar position information (or None for the latter if filtered_elt_pos is set to False or if the cloud Dataframe has not been build with with_coords option)
- cars.applications.triangulation.pc_transform.depth_map_dataset_to_dataframe(cloud_dataset: xarray.Dataset, dsm_epsg: int, xmin: float = None, xmax: float = None, ymin: int = None, ymax: int = None, margin: float = 0, with_coords: bool = False) Tuple[pandas.DataFrame, int][source]
Combine a list of clouds (and their colors) into a pandas dataframe structured with the following labels:
- if no colors in input and no mask data present in cloud_list datasets:
labels=[cst.X, cst.Y, cst.Z] The combined cloud has x, y, z columns
- if no colors in input and mask data present in cloud_list datasets:
labels=[cst.X, cst.Y, cst.Z, cst.POINT_CLOUD_MSK] The mask values are added to the dataframe.
- if colors are set in input and mask data are present in the cloud_list datasets:
labels=[cst.X, cst.Y, cst.Z, cst.POINT_CLOUD_MSK, cst.POINT_CLOUD_CLR_KEY_ROOT+”0”, cst.POINT_CLOUD_CLR_KEY_ROOT+”1”, cst.POINT_CLOUD_CLR_KEY_ROOT+”2”] Color channels information are added to the dataframe.
- if colors in input, mask data present in the cloud_list datasets and the with_coords option is activated:
labels=[cst.X, cst.Y, cst.Z, cst.POINT_CLOUD_MSK, cst.POINT_CLOUD_CLR_KEY_ROOT+”0”, cst.POINT_CLOUD_CLR_KEY_ROOT+”1”, cst.POINT_CLOUD_CLR_KEY_ROOT+”2” cst.POINT_CLOUD_COORD_EPI_GEOM_I, cst.POINT_CLOUD_COORD_EPI_GEOM_J, cst.POINT_CLOUD_ID_IM_EPI] The pixel position of the xyz point in the original epipolar image (coord_epi_geom_i, coord_epi_geom_j) are added to the dataframe along with the index of its original cloud in the cloud_list input.
if confidence intervals on Z in input, then [cst.Z_INF, cst.Z_SUP] are also added to the labels
- Parameters:
dsm_epsg – epsg code for the CRS of the final output raster
xmin – xmin of the rasterization grid (if None, the whole clouds are combined)
xmax – xmax of the rasterization grid (if None, the whole clouds are combined)
ymin – ymin of the rasterization grid (if None, the whole clouds are combined)
ymax – ymax of the rasterization grid (if None, the whole clouds are combined)
margin – Margin added for each tile, in meter or degree. (default value: 0)
with_coords – Option enabling the adding to the combined cloud of information of each point to retrieve their positions in the original epipolar images
- Returns:
Tuple formed with the combined clouds and color in a single pandas dataframe and the epsg code