Point Cloud Library (PCL)  1.14.1-dev
List of all members | Public Member Functions | Protected Attributes
pcl::MedianFilter< PointT > Class Template Reference

Implementation of the median filter. More...

#include <pcl/filters/median_filter.h>

+ Inheritance diagram for pcl::MedianFilter< PointT >:
+ Collaboration diagram for pcl::MedianFilter< PointT >:

Public Member Functions

 MedianFilter ()=default
 Empty constructor. More...
 
void setWindowSize (int window_size)
 Set the window size of the filter. More...
 
int getWindowSize () const
 Get the window size of the filter. More...
 
void setMaxAllowedMovement (float max_allowed_movement)
 Set the largest value one dexel is allowed to move. More...
 
float getMaxAllowedMovement () const
 Get the maximum distance one point is allowed to move along the z-axis. More...
 
void applyFilter (PointCloud &output) override
 Filter the input data and store the results into output. More...
 
- Public Member Functions inherited from pcl::Filter< PointT >
 Filter (bool extract_removed_indices=false)
 Empty constructor. More...
 
IndicesConstPtr const getRemovedIndices () const
 Get the point indices being removed. More...
 
void getRemovedIndices (PointIndices &pi)
 Get the point indices being removed. More...
 
void filter (PointCloud &output)
 Calls the filtering method and returns the filtered dataset in output. More...
 
- Public Member Functions inherited from pcl::PCLBase< PointT >
 PCLBase ()
 Empty constructor. More...
 
 PCLBase (const PCLBase &base)
 Copy constructor. More...
 
virtual ~PCLBase ()=default
 Destructor. More...
 
virtual void setInputCloud (const PointCloudConstPtr &cloud)
 Provide a pointer to the input dataset. More...
 
PointCloudConstPtr const getInputCloud () const
 Get a pointer to the input point cloud dataset. More...
 
virtual void setIndices (const IndicesPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (const IndicesConstPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (const PointIndicesConstPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (std::size_t row_start, std::size_t col_start, std::size_t nb_rows, std::size_t nb_cols)
 Set the indices for the points laying within an interest region of the point cloud. More...
 
IndicesPtr getIndices ()
 Get a pointer to the vector of indices used. More...
 
IndicesConstPtr const getIndices () const
 Get a pointer to the vector of indices used. More...
 
const PointToperator[] (std::size_t pos) const
 Override PointCloud operator[] to shorten code. More...
 

Protected Attributes

int window_size_ {5}
 
float max_allowed_movement_ {std::numeric_limits<float>::max ()}
 
- Protected Attributes inherited from pcl::Filter< PointT >
IndicesPtr removed_indices_
 Indices of the points that are removed. More...
 
std::string filter_name_
 The filter name. More...
 
bool extract_removed_indices_
 Set to true if we want to return the indices of the removed points. More...
 
- Protected Attributes inherited from pcl::PCLBase< PointT >
PointCloudConstPtr input_
 The input point cloud dataset. More...
 
IndicesPtr indices_
 A pointer to the vector of point indices to use. More...
 
bool use_indices_
 Set to true if point indices are used. More...
 
bool fake_indices_
 If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud. More...
 

Additional Inherited Members

- Public Types inherited from pcl::Filter< PointT >
using Ptr = shared_ptr< Filter< PointT > >
 
using ConstPtr = shared_ptr< const Filter< PointT > >
 
using PointCloud = pcl::PointCloud< PointT >
 
using PointCloudPtr = typename PointCloud::Ptr
 
using PointCloudConstPtr = typename PointCloud::ConstPtr
 
- Public Types inherited from pcl::PCLBase< PointT >
using PointCloud = pcl::PointCloud< PointT >
 
using PointCloudPtr = typename PointCloud::Ptr
 
using PointCloudConstPtr = typename PointCloud::ConstPtr
 
using PointIndicesPtr = PointIndices::Ptr
 
using PointIndicesConstPtr = PointIndices::ConstPtr
 
- Protected Member Functions inherited from pcl::Filter< PointT >
const std::string & getClassName () const
 Get a string representation of the name of this class. More...
 
- Protected Member Functions inherited from pcl::PCLBase< PointT >
bool initCompute ()
 This method should get called before starting the actual computation. More...
 
bool deinitCompute ()
 This method should get called after finishing the actual computation. More...
 

Detailed Description

template<typename PointT>
class pcl::MedianFilter< PointT >

Implementation of the median filter.

The median filter is one of the simplest and wide-spread image processing filters. It is known to perform well with "shot"/impulse noise (some individual pixels having extreme values), it does not reduce contrast across steps in the function (as compared to filters based on averaging), and it is robust to outliers. Furthermore, it is simple to implement and efficient, as it requires a single pass over the image. It consists of a moving window of fixed size that replaces the pixel in the center with the median inside the window.

Note
This algorithm filters only the depth (z-component) of organized and untransformed (i.e., in camera coordinates) point clouds. An error will be outputted if an unorganized cloud is given to the class instance.
Author
Alexandru E. Ichim

Definition at line 60 of file median_filter.h.

Constructor & Destructor Documentation

◆ MedianFilter()

template<typename PointT >
pcl::MedianFilter< PointT >::MedianFilter ( )
default

Empty constructor.

Member Function Documentation

◆ applyFilter()

template<typename PointT >
void pcl::MedianFilter< PointT >::applyFilter ( PointCloud output)
overridevirtual

Filter the input data and store the results into output.

Parameters
[out]outputthe result point cloud

Implements pcl::Filter< PointT >.

Definition at line 46 of file median_filter.hpp.

References pcl::copyPointCloud(), pcl::PointCloud< PointT >::height, pcl::isFinite(), and pcl::PointCloud< PointT >::width.

◆ getMaxAllowedMovement()

template<typename PointT >
float pcl::MedianFilter< PointT >::getMaxAllowedMovement ( ) const
inline

Get the maximum distance one point is allowed to move along the z-axis.

Returns
the maximum distance a dexel is allowed to move

Definition at line 94 of file median_filter.h.

References pcl::MedianFilter< PointT >::max_allowed_movement_.

◆ getWindowSize()

template<typename PointT >
int pcl::MedianFilter< PointT >::getWindowSize ( ) const
inline

Get the window size of the filter.

Returns
the window size of the filter

Definition at line 80 of file median_filter.h.

References pcl::MedianFilter< PointT >::window_size_.

◆ setMaxAllowedMovement()

template<typename PointT >
void pcl::MedianFilter< PointT >::setMaxAllowedMovement ( float  max_allowed_movement)
inline

Set the largest value one dexel is allowed to move.

Parameters
[in]max_allowed_movementmaximum value a dexel is allowed to move during filtering

Definition at line 87 of file median_filter.h.

References pcl::MedianFilter< PointT >::max_allowed_movement_.

◆ setWindowSize()

template<typename PointT >
void pcl::MedianFilter< PointT >::setWindowSize ( int  window_size)
inline

Set the window size of the filter.

Parameters
[in]window_sizethe new window size

Definition at line 73 of file median_filter.h.

References pcl::MedianFilter< PointT >::window_size_.

Member Data Documentation

◆ max_allowed_movement_

template<typename PointT >
float pcl::MedianFilter< PointT >::max_allowed_movement_ {std::numeric_limits<float>::max ()}
protected

◆ window_size_

template<typename PointT >
int pcl::MedianFilter< PointT >::window_size_ {5}
protected

The documentation for this class was generated from the following files: