StatisticalOutlierRemoval uses point neighborhood statistics to filter outlier data. More...
#include <statistical_outlier_removal.h>
Public Member Functions | |
int | getMeanK () |
Get the number of nearest neighbors to use for mean distance estimation. | |
double | getStddevMulThresh () |
Get the standard deviation multiplier for the distance threshold calculation. | |
void | setMeanK (int nr_k) |
Set the number of nearest neighbors to use for mean distance estimation. | |
void | setStddevMulThresh (double stddev_mult) |
Set the standard deviation multiplier for the distance threshold calculation. | |
StatisticalOutlierRemoval (bool extract_removed_indices=false) | |
Constructor. | |
Protected Types | |
typedef FilterIndices< PointT > ::PointCloud | PointCloud |
typedef PointCloud::ConstPtr | PointCloudConstPtr |
typedef PointCloud::Ptr | PointCloudPtr |
typedef pcl::search::Search < PointT >::Ptr | SearcherPtr |
Protected Member Functions | |
void | applyFilter (PointCloud &output) |
Filtered results are stored in a separate point cloud. | |
void | applyFilter (std::vector< int > &indices) |
Filtered results are indexed by an indices array. | |
void | applyFilterIndices (std::vector< int > &indices) |
Filtered results are indexed by an indices array. | |
Private Attributes | |
int | mean_k_ |
The number of points to use for mean distance estimation. | |
SearcherPtr | searcher_ |
A pointer to the spatial search object. | |
double | std_mul_ |
Standard deviations threshold (i.e., points outside of will be marked as outliers). |
StatisticalOutlierRemoval uses point neighborhood statistics to filter outlier data.
The algorithm iterates through the entire input twice: During the first iteration it will compute the average distance that each point has to its nearest k neighbors. The value of k can be set using setMeanK(). Next, the mean and standard deviation of all these distances are computed in order to determine a distance threshold. The distance threshold will be equal to: mean + stddev_mult * stddev. The multiplier for the standard deviation can be set using setStddevMulThresh(). During the next iteration the points will be classified as inlier or outlier if their average neighbor distance is below or above this threshold respectively.
The neighbors found for each query point will be found amongst ALL points of setInputCloud(), not just those indexed by setIndices(). The setIndices() method only indexes the points that will be iterated through as search query points.
For more information:
pcl::StatisticalOutlierRemoval<PointType> sorfilter (true); // Initializing with true will allow us to extract the removed indices sorfilter.setInputCloud (cloud_in); sorfilter.setMeanK (8); sorfilter.setStddevMulThresh (1.0); sorfilter.filter (*cloud_out); // The resulting cloud_out contains all points of cloud_in that have an average distance to their 8 nearest neighbors that is below the computed threshold // Using a standard deviation multiplier of 1.0 and assuming the average distances are normally distributed there is a 84.1% chance that a point will be an inlier indices_rem = sorfilter.getRemovedIndices (); // The indices_rem array indexes all points of cloud_in that are outliers
Definition at line 81 of file statistical_outlier_removal.h.
typedef FilterIndices<PointT>::PointCloud pcl::StatisticalOutlierRemoval< PointT >::PointCloud [protected] |
Reimplemented from pcl::FilterIndices< PointT >.
Definition at line 84 of file statistical_outlier_removal.h.
typedef PointCloud::ConstPtr pcl::StatisticalOutlierRemoval< PointT >::PointCloudConstPtr [protected] |
Reimplemented from pcl::Filter< PointT >.
Definition at line 86 of file statistical_outlier_removal.h.
typedef PointCloud::Ptr pcl::StatisticalOutlierRemoval< PointT >::PointCloudPtr [protected] |
Reimplemented from pcl::Filter< PointT >.
Definition at line 85 of file statistical_outlier_removal.h.
typedef pcl::search::Search<PointT>::Ptr pcl::StatisticalOutlierRemoval< PointT >::SearcherPtr [protected] |
Definition at line 87 of file statistical_outlier_removal.h.
pcl::StatisticalOutlierRemoval< PointT >::StatisticalOutlierRemoval | ( | bool | extract_removed_indices = false | ) | [inline] |
Constructor.
[in] | extract_removed_indices | Set to true if you want to be able to extract the indices of points being removed (default = false). |
Definition at line 93 of file statistical_outlier_removal.h.
void pcl::StatisticalOutlierRemoval< PointT >::applyFilter | ( | PointCloud & | output | ) | [protected, virtual] |
Filtered results are stored in a separate point cloud.
[out] | output | The resultant point cloud. |
Implements pcl::Filter< PointT >.
Definition at line 48 of file statistical_outlier_removal.hpp.
void pcl::StatisticalOutlierRemoval< PointT >::applyFilter | ( | std::vector< int > & | indices | ) | [inline, protected, virtual] |
Filtered results are indexed by an indices array.
[out] | indices | The resultant indices. |
Implements pcl::FilterIndices< PointT >.
Definition at line 163 of file statistical_outlier_removal.h.
void pcl::StatisticalOutlierRemoval< PointT >::applyFilterIndices | ( | std::vector< int > & | indices | ) | [protected] |
Filtered results are indexed by an indices array.
[out] | indices | The resultant indices. |
Definition at line 73 of file statistical_outlier_removal.hpp.
int pcl::StatisticalOutlierRemoval< PointT >::getMeanK | ( | ) | [inline] |
Get the number of nearest neighbors to use for mean distance estimation.
Definition at line 115 of file statistical_outlier_removal.h.
double pcl::StatisticalOutlierRemoval< PointT >::getStddevMulThresh | ( | ) | [inline] |
Get the standard deviation multiplier for the distance threshold calculation.
The distance threshold will be equal to: mean + stddev_mult * stddev. Points will be classified as inlier or outlier if their average neighbor distance is below or above this threshold respectively.
[in] | stddev_mult | The standard deviation multiplier. |
Definition at line 137 of file statistical_outlier_removal.h.
void pcl::StatisticalOutlierRemoval< PointT >::setMeanK | ( | int | nr_k | ) | [inline] |
Set the number of nearest neighbors to use for mean distance estimation.
[in] | nr_k | The number of points to use for mean distance estimation. |
Definition at line 106 of file statistical_outlier_removal.h.
void pcl::StatisticalOutlierRemoval< PointT >::setStddevMulThresh | ( | double | stddev_mult | ) | [inline] |
Set the standard deviation multiplier for the distance threshold calculation.
The distance threshold will be equal to: mean + stddev_mult * stddev. Points will be classified as inlier or outlier if their average neighbor distance is below or above this threshold respectively.
[in] | stddev_mult | The standard deviation multiplier. |
Definition at line 126 of file statistical_outlier_removal.h.
int pcl::StatisticalOutlierRemoval< PointT >::mean_k_ [private] |
The number of points to use for mean distance estimation.
Definition at line 179 of file statistical_outlier_removal.h.
SearcherPtr pcl::StatisticalOutlierRemoval< PointT >::searcher_ [private] |
A pointer to the spatial search object.
Definition at line 176 of file statistical_outlier_removal.h.
double pcl::StatisticalOutlierRemoval< PointT >::std_mul_ [private] |
Standard deviations threshold (i.e., points outside of will be marked as outliers).
Definition at line 183 of file statistical_outlier_removal.h.