cars.applications.point_cloud_outlier_removal.outlier_removal_algo

This module contains functions used in outlier removal

Functions

small_component_filtering(→ Tuple[pandas.DataFrame, ...)

Filter point cloud to remove small clusters of points

detect_small_components(→ List[int])

Determine the indexes of the points of cloud_xyz to filter.

statistical_outlier_filtering(...)

Filter point cloud to remove statistical outliers

detect_statistical_outliers(→ List[int])

Determine the indexes of the points of cloud_xyz to filter.

epipolar_small_components(cloud[, min_cluster_size, ...])

Filter outliers using the small components method in epipolar geometry

epipolar_statistical_filtering(epipolar_ds[, k, ...])

Filter outliers using the statistical method in epipolar geometry

Module Contents

cars.applications.point_cloud_outlier_removal.outlier_removal_algo.small_component_filtering(cloud: pandas.DataFrame, connection_val: float, nb_pts_threshold: int, clusters_distance_threshold: float = None, filtered_elt_pos: bool = False) Tuple[pandas.DataFrame, None | pandas.DataFrame][source]

Filter point cloud to remove small clusters of points (see the detect_small_components function).

Parameters:
  • cloud – combined cloud as returned by the create_combined_cloud function

  • connection_val – distance to use to consider that two points are connected

  • nb_pts_threshold – number of points to use to identify small clusters to filter

  • clusters_distance_threshold – distance to use to consider if two points clusters are far from each other or not (set to None to deactivate this level of filtering)

  • 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 made of the filtered cloud and the removed elements positions in their epipolar images

cars.applications.point_cloud_outlier_removal.outlier_removal_algo.detect_small_components(cloud_xyz: numpy.ndarray, connection_val: float, nb_pts_threshold: int, clusters_distance_threshold: float = None) List[int][source]

Determine the indexes of the points of cloud_xyz to filter. The clusters are made of ‘connected’ points (2 connected points have a distance smaller than connection_val)

The removed clusters are composed of less than nb_pts_threshold points and are also far from other clusters (points are further than clusters_distance_threshold).

If clusters_distance_threshold is set to None, all the clusters that are composed of less than nb_pts_threshold points are filtered.

Parameters:
  • cloud_xyz – points kdTree

  • connection_val – distance to use to consider that two points are connected

  • nb_pts_threshold – number of points to use to identify small clusters to filter

  • clusters_distance_threshold – distance to use to consider if two points clusters are far from each other or not (set to None to deactivate this level of filtering)

Returns:

list of the points to filter indexes

cars.applications.point_cloud_outlier_removal.outlier_removal_algo.statistical_outlier_filtering(cloud: pandas.DataFrame, k: int, filtering_constant: float, mean_factor: float, dev_factor: float, use_median: bool = False, filtered_elt_pos: bool = False) Tuple[pandas.DataFrame, None | pandas.DataFrame][source]

Filter point cloud to remove statistical outliers (see the detect_statistical_outliers function).

Parameters:
  • cloud – combined cloud as returned by the create_combined_cloud function

  • k – number of neighbors

  • filtering_constant – constant added to the distance threshold

  • mean_factor – multiplication factor of mean used to compute the distance threshold

  • dev_factor – multiplication factor of deviation used to compute the distance threshold

  • use_median – choice of statistical measure used to filter

  • 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 made of the filtered cloud and the removed elements positions in their epipolar images

cars.applications.point_cloud_outlier_removal.outlier_removal_algo.detect_statistical_outliers(cloud_xyz: numpy.ndarray, k: int, dev_factor: float, use_median: bool) List[int][source]

Determine the indexes of the points of cloud_xyz to filter. The removed points have mean distances with their k nearest neighbors that are greater than a distance threshold (dist_thresh).

This threshold is computed from the mean (or median) and standard deviation (or interquartile range) of all the points mean distances with their k nearest neighbors:

(1) dist_thresh = mean_distances + dev_factor * std_distances or (2) dist_thresh = median_distances + dev_factor * iqr_distances

Parameters:
  • cloud_xyz – points kdTree

  • k – number of neighbors

  • dev_factor – multiplication factor of deviation used to compute the distance threshold

  • use_median – if True formula (2) is used for threshold, else formula (1)

Returns:

list of the points to filter indexes

cars.applications.point_cloud_outlier_removal.outlier_removal_algo.epipolar_small_components(cloud, min_cluster_size=15, radius=1.0, half_window_size=5, clusters_distance_threshold=np.nan)[source]

Filter outliers using the small components method in epipolar geometry

Parameters:
  • epipolar_ds (xr.Dataset) – epipolar dataset to filter

  • statistical_k (int) – k

  • std_dev_factor (float) – std factor

  • half_window_size (int) – use median and quartile instead of mean and std

  • use_median (bool) – use median and quartile instead of mean and std

Returns:

filtered dataset

Return type:

xr.Dataset

cars.applications.point_cloud_outlier_removal.outlier_removal_algo.epipolar_statistical_filtering(epipolar_ds, k=15, filtering_constant=0.0, mean_factor=1.0, dev_factor=1.0, half_window_size=5, use_median=False)[source]

Filter outliers using the statistical method in epipolar geometry

Parameters:
  • epipolar_ds (xr.Dataset) – epipolar dataset to filter

  • statistical_k (int) – k

  • std_dev_factor (float) – std factor

  • half_window_size (int) – use median and quartile instead of mean and std

  • use_median (bool) – use median and quartile instead of mean and std

Returns:

filtered dataset

Return type:

xr.Dataset