cars.applications.point_cloud_fusion.point_cloud_tools
This module is responsible for the transition between triangulation and rasterization steps
Module Contents
Functions
|
Combine a list of clouds from sparse or dense matching |
|
Combine a list of clouds (and their colors) into a pandas dataframe |
|
Extract epsg from cloud list and check if all the same |
|
Delete masked points with terrain tile mask |
|
Compute terrain tile msk bounds |
|
Combine a list of clouds (and their colors) into a pandas dataframe |
|
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. |
|
Get max number of bands of clouds |
|
Filter all points of the cloud DataFrame |
|
Add a uint16 mask labeled 'mask_label' to the clouds in clouds_list. |
- cars.applications.point_cloud_fusion.point_cloud_tools.create_combined_cloud(cloud_list: List[xr.Dataset] or List[pandas.DataFrame], cloud_ids: List[int], 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]
Combine a list of clouds from sparse or dense matching into a pandas dataframe. The detailed cases for each cloud type are in the derived function create_combined_sparse_cloud and create_combined_dense_cloud.
- Parameters
cloud_list – list of every point cloud to merge
cloud_ids – list of global identificators of clouds in cloud_list
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
- cars.applications.point_cloud_fusion.point_cloud_tools.create_combined_sparse_cloud(cloud_list: List[pandas.DataFrame], cloud_ids: List[int], 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]
Combine a list of clouds (and their colors) into a pandas dataframe structured with the following labels:
- if no mask data present in cloud_list datasets:
labels=[ cst.X, cst.Y, cst.Z] The combined cloud has x, y, z columns
- if 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.
- 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
- cars.applications.point_cloud_fusion.point_cloud_tools.get_epsg(cloud_list)
Extract epsg from cloud list and check if all the same
- Parameters
cloud_list – list of the point clouds
- cars.applications.point_cloud_fusion.point_cloud_tools.filter_cloud_with_mask(nb_points, crop_cloud, crop_terrain_tile_data_msk)
Delete masked points with terrain tile mask
- Parameters
nb_points – total number of point cloud (increase at each point cloud)
crop_cloud – the point cloud
crop_terrain_tile_data_msk – terrain tile mask
- cars.applications.point_cloud_fusion.point_cloud_tools.compute_terrain_msk(dsm_epsg, xmin, xmax, ymin, ymax, margin, epsg, point_cloud, full_x, full_y)
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.point_cloud_fusion.point_cloud_tools.create_combined_dense_cloud(cloud_list: List[xarray.Dataset], cloud_id: List[int], 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]
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
- cars.applications.point_cloud_fusion.point_cloud_tools.create_point_cloud_index(cloud_sample)
Create point cloud index from cloud list keys and color inputs
- cars.applications.point_cloud_fusion.point_cloud_tools.add_information_to_cloud(input_cloud, cloud_indexes, bbox, target_cloud, input_array, output_column)
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.point_cloud_fusion.point_cloud_tools.get_color_type(clouds)
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.point_cloud_fusion.point_cloud_tools.get_number_bands(cloud_list)
Get max number of bands of clouds
- Parameters
cloud_list (xarray Dataset) – list of clouds
- Returns
max number of band
- Return type
int
- cars.applications.point_cloud_fusion.point_cloud_tools.filter_cloud(cloud: pandas.DataFrame, index_elt_to_remove: List[int], filtered_elt_pos: bool = False) Tuple[pandas.DataFrame, Union[None, pandas.DataFrame]]
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.point_cloud_fusion.point_cloud_tools.add_cloud_filtering_msk(clouds_list: List[xarray.Dataset], elt_pos_infos: pandas.DataFrame, mask_label: str, mask_value: int = 255)
Add a uint16 mask labeled ‘mask_label’ to the clouds in clouds_list. (in-line function)
TODO only used in tests
- Parameters
clouds_list – Input list of clouds
elt_pos_infos – pandas dataframe composed of cst.POINT_CLOUD_COORD_EPI_GEOM_I, cst.POINT_CLOUD_COORD_EPI_GEOM_J, cst.POINT_CLOUD_ID_IM_EPI columns as computed in the create_combined_cloud function. Those information are used to retrieve the point position in its original epipolar image.
mask_label – label to give to the mask in the datasets
mask_value – filtered elements value in the mask