Point Cloud Library (PCL) 1.15.0
Loading...
Searching...
No Matches
pcl::filters::Convolution< PointIn, PointOut > Class Template Reference

Convolution is a mathematical operation on two functions f and g, producing a third function that is typically viewed as a modified version of one of the original functions. More...

#include <pcl/filters/convolution.h>

Public Types

enum  BORDERS_POLICY { BORDERS_POLICY_IGNORE = -1 , BORDERS_POLICY_MIRROR = 0 , BORDERS_POLICY_DUPLICATE = 1 }
 The borders policy available. More...
using PointCloudIn = pcl::PointCloud<PointIn>
using PointCloudInPtr = typename PointCloudIn::Ptr
using PointCloudInConstPtr = typename PointCloudIn::ConstPtr
using PointCloudOut = pcl::PointCloud<PointOut>
using Ptr = shared_ptr< Convolution<PointIn, PointOut> >
using ConstPtr = shared_ptr< const Convolution<PointIn, PointOut> >

Public Member Functions

 Convolution ()
 Constructor.
 ~Convolution ()=default
 Empty destructor.
void setInputCloud (const PointCloudInConstPtr &cloud)
 Provide a pointer to the input dataset.
void setKernel (const Eigen::ArrayXf &kernel)
 Set convolving kernel.
void setBordersPolicy (int policy)
 Set the borders policy.
int getBordersPolicy ()
 Get the borders policy.
void setDistanceThreshold (const float &threshold)
const float & getDistanceThreshold () const
void setNumberOfThreads (unsigned int nr_threads=0)
 Initialize the scheduler and set the number of threads to use.
void convolveRows (PointCloudOut &output)
 Convolve a float image rows by a given kernel.
void convolveCols (PointCloudOut &output)
 Convolve a float image columns by a given kernel.
void convolve (const Eigen::ArrayXf &h_kernel, const Eigen::ArrayXf &v_kernel, PointCloudOut &output)
 Convolve point cloud with an horizontal kernel along rows then vertical kernel along columns : convolve separately.
void convolve (PointCloudOut &output)
 Convolve point cloud with same kernel along rows and columns separately.

Protected Member Functions

void convolve_rows (PointCloudOut &output)
 convolve rows and ignore borders
void convolve_cols (PointCloudOut &output)
 convolve cols and ignore borders
void convolve_rows_mirror (PointCloudOut &output)
 convolve rows and mirror borders
void convolve_cols_mirror (PointCloudOut &output)
 convolve cols and mirror borders
void convolve_rows_duplicate (PointCloudOut &output)
 convolve rows and duplicate borders
void convolve_cols_duplicate (PointCloudOut &output)
 convolve cols and duplicate borders
void initCompute (PointCloudOut &output)
 init compute is an internal method called before computation
void makeInfinite (PointOut &p)
void makeInfinite (pcl::RGB &p)

Protected Attributes

unsigned int threads_ {1}
 The number of threads the scheduler should use.

Detailed Description

template<typename PointIn, typename PointOut>
class pcl::filters::Convolution< PointIn, PointOut >

Convolution is a mathematical operation on two functions f and g, producing a third function that is typically viewed as a modified version of one of the original functions.

see https://en.wikipedia.org/wiki/Convolution.

The class provides rows, column and separate convolving operations of a point cloud. Columns and separate convolution is only allowed on organised point clouds.

When convolving, computing the rows and cols elements at 1/2 kernel width distance from the borders is not defined. We allow for 3 policies:

  • Ignoring: elements at special locations are filled with zero (default behaviour)
  • Mirroring: the missing rows or columns are obtained through mirroring
  • Duplicating: the missing rows or columns are obtained through duplicating
Author
Nizar Sallem

Definition at line 72 of file convolution.h.

Member Typedef Documentation

◆ ConstPtr

template<typename PointIn, typename PointOut>
using pcl::filters::Convolution< PointIn, PointOut >::ConstPtr = shared_ptr< const Convolution<PointIn, PointOut> >

Definition at line 80 of file convolution.h.

◆ PointCloudIn

template<typename PointIn, typename PointOut>
using pcl::filters::Convolution< PointIn, PointOut >::PointCloudIn = pcl::PointCloud<PointIn>

Definition at line 75 of file convolution.h.

◆ PointCloudInConstPtr

template<typename PointIn, typename PointOut>
using pcl::filters::Convolution< PointIn, PointOut >::PointCloudInConstPtr = typename PointCloudIn::ConstPtr

Definition at line 77 of file convolution.h.

◆ PointCloudInPtr

template<typename PointIn, typename PointOut>
using pcl::filters::Convolution< PointIn, PointOut >::PointCloudInPtr = typename PointCloudIn::Ptr

Definition at line 76 of file convolution.h.

◆ PointCloudOut

template<typename PointIn, typename PointOut>
using pcl::filters::Convolution< PointIn, PointOut >::PointCloudOut = pcl::PointCloud<PointOut>

Definition at line 78 of file convolution.h.

◆ Ptr

template<typename PointIn, typename PointOut>
using pcl::filters::Convolution< PointIn, PointOut >::Ptr = shared_ptr< Convolution<PointIn, PointOut> >

Definition at line 79 of file convolution.h.

Member Enumeration Documentation

◆ BORDERS_POLICY

template<typename PointIn, typename PointOut>
enum pcl::filters::Convolution::BORDERS_POLICY

The borders policy available.

Enumerator
BORDERS_POLICY_IGNORE 
BORDERS_POLICY_MIRROR 
BORDERS_POLICY_DUPLICATE 

Definition at line 84 of file convolution.h.

Constructor & Destructor Documentation

◆ Convolution()

template<typename PointIn, typename PointOut>
pcl::filters::Convolution< PointIn, PointOut >::Convolution ( )

Constructor.

Definition at line 54 of file convolution.hpp.

References BORDERS_POLICY_IGNORE.

◆ ~Convolution()

template<typename PointIn, typename PointOut>
pcl::filters::Convolution< PointIn, PointOut >::~Convolution ( )
default

Empty destructor.

Member Function Documentation

◆ convolve() [1/2]

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::convolve ( const Eigen::ArrayXf & h_kernel,
const Eigen::ArrayXf & v_kernel,
PointCloudOut & output )
inline

Convolve point cloud with an horizontal kernel along rows then vertical kernel along columns : convolve separately.

Parameters
[in]h_kernelkernel for convolving rows
[in]v_kernelkernel for convolving columns
[out]outputthe convolved cloud
Note
if output doesn't fit in input i.e. output.rows () < input.rows () or output.cols () < input.cols () then output is resized to input sizes.

Definition at line 132 of file convolution.hpp.

References convolveCols(), convolveRows(), setInputCloud(), and setKernel().

Referenced by pcl::ColorGradientModality< PointInT >::processInputData().

◆ convolve() [2/2]

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::convolve ( PointCloudOut & output)
inline

Convolve point cloud with same kernel along rows and columns separately.

Parameters
[out]outputthe convolved cloud
Note
if output doesn't fit in input i.e. output.rows () < input.rows () or output.cols () < input.cols () then output is resized to input sizes.

Definition at line 153 of file convolution.hpp.

References convolveCols(), convolveRows(), and setInputCloud().

◆ convolve_cols()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::convolve_cols ( PointCloudOut & output)
protected

convolve cols and ignore borders

Definition at line 418 of file convolution.hpp.

References makeInfinite().

Referenced by convolveCols().

◆ convolve_cols_duplicate()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::convolve_cols_duplicate ( PointCloudOut & output)
protected

convolve cols and duplicate borders

Definition at line 464 of file convolution.hpp.

Referenced by convolveCols().

◆ convolve_cols_mirror()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::convolve_cols_mirror ( PointCloudOut & output)
protected

convolve cols and mirror borders

Definition at line 511 of file convolution.hpp.

Referenced by convolveCols().

◆ convolve_rows()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::convolve_rows ( PointCloudOut & output)
protected

convolve rows and ignore borders

Definition at line 278 of file convolution.hpp.

References makeInfinite().

Referenced by convolveRows().

◆ convolve_rows_duplicate()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::convolve_rows_duplicate ( PointCloudOut & output)
protected

convolve rows and duplicate borders

Definition at line 324 of file convolution.hpp.

Referenced by convolveRows().

◆ convolve_rows_mirror()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::convolve_rows_mirror ( PointCloudOut & output)
protected

convolve rows and mirror borders

Definition at line 371 of file convolution.hpp.

Referenced by convolveRows().

◆ convolveCols()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::convolveCols ( PointCloudOut & output)
inline

Convolve a float image columns by a given kernel.

Parameters
[out]outputthe convolved image
Note
if output doesn't fit in input i.e. output.rows () < input.rows () or output.cols () < input.cols () then output is resized to input sizes.

Definition at line 112 of file convolution.hpp.

References BORDERS_POLICY_DUPLICATE, BORDERS_POLICY_IGNORE, BORDERS_POLICY_MIRROR, convolve_cols(), convolve_cols_duplicate(), convolve_cols_mirror(), and initCompute().

Referenced by convolve(), and convolve().

◆ convolveRows()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::convolveRows ( PointCloudOut & output)
inline

Convolve a float image rows by a given kernel.

Parameters
[out]outputthe convolved cloud
Note
if output doesn't fit in input i.e. output.rows () < input.rows () or output.cols () < input.cols () then output is resized to input sizes.

Definition at line 92 of file convolution.hpp.

References BORDERS_POLICY_DUPLICATE, BORDERS_POLICY_IGNORE, BORDERS_POLICY_MIRROR, convolve_rows(), convolve_rows_duplicate(), convolve_rows_mirror(), and initCompute().

Referenced by convolve(), and convolve().

◆ getBordersPolicy()

template<typename PointIn, typename PointOut>
int pcl::filters::Convolution< PointIn, PointOut >::getBordersPolicy ( )
inline

Get the borders policy.

Definition at line 110 of file convolution.h.

◆ getDistanceThreshold()

template<typename PointIn, typename PointOut>
const float & pcl::filters::Convolution< PointIn, PointOut >::getDistanceThreshold ( ) const
inline
Returns
the distance threshold

Definition at line 122 of file convolution.h.

◆ initCompute()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::initCompute ( PointCloudOut & output)
protected

◆ makeInfinite() [1/2]

void pcl::filters::Convolution< pcl::RGB, pcl::RGB >::makeInfinite ( pcl::RGB & p)
inlineprotected

Definition at line 272 of file convolution.hpp.

◆ makeInfinite() [2/2]

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::makeInfinite ( PointOut & p)
inlineprotected

Definition at line 224 of file convolution.h.

Referenced by convolve_cols(), and convolve_rows().

◆ setBordersPolicy()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::setBordersPolicy ( int policy)
inline

Set the borders policy.

Definition at line 107 of file convolution.h.

Referenced by pcl::ColorGradientModality< PointInT >::processInputData().

◆ setDistanceThreshold()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::setDistanceThreshold ( const float & threshold)
inline
Remarks
this is critical so please read it carefully. In 3D the next point in (u,v) coordinate can be really far so a distance threshold is used to keep us from ghost points. The value you set here is strongly related to the sensor. A good value for kinect data is 0.001. Default is std::numeric<float>::infinity ()
Parameters
[in]thresholdmaximum allowed distance between 2 juxtaposed points

Definition at line 119 of file convolution.h.

◆ setInputCloud()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::setInputCloud ( const PointCloudInConstPtr & cloud)
inline

Provide a pointer to the input dataset.

Parameters
cloudthe const boost shared pointer to a PointCloud message
Remarks
Will perform a deep copy

Definition at line 99 of file convolution.h.

Referenced by convolve(), convolve(), and pcl::ColorGradientModality< PointInT >::processInputData().

◆ setKernel()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::setKernel ( const Eigen::ArrayXf & kernel)
inline

Set convolving kernel.

Parameters
[in]kernelconvolving element

Definition at line 104 of file convolution.h.

Referenced by convolve(), and pcl::ColorGradientModality< PointInT >::processInputData().

◆ setNumberOfThreads()

template<typename PointIn, typename PointOut>
void pcl::filters::Convolution< PointIn, PointOut >::setNumberOfThreads ( unsigned int nr_threads = 0)
inline

Initialize the scheduler and set the number of threads to use.

Parameters
nr_threadsthe number of hardware threads to use (0 sets the value back to automatic)

Definition at line 127 of file convolution.h.

References threads_.

Member Data Documentation

◆ threads_

template<typename PointIn, typename PointOut>
unsigned int pcl::filters::Convolution< PointIn, PointOut >::threads_ {1}
protected

The number of threads the scheduler should use.

Definition at line 221 of file convolution.h.

Referenced by setNumberOfThreads().


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