PCL
pcl::SeparableFilter Class Reference

Separable filter in two dimensions. More...

#include <SeparableFilter.h>

Public Types

using coefficient = float
 
using coefficient_matrix = GenericMatrix< coefficient >
 
using coefficient_vector = GenericVector< coefficient >
 

Public Member Functions

 SeparableFilter (const coefficient_vector &h, const coefficient_vector &v, const String &name=String())
 
 SeparableFilter (const SeparableFilter &)=default
 
 SeparableFilter (const String &name=String())
 
template<typename T >
 SeparableFilter (const T *h, const T *v, int n, const String &name=String())
 
 SeparableFilter (int n, const String &name=String())
 
template<typename T >
 SeparableFilter (int n, const T &x, const String &name=String())
 
 SeparableFilter (SeparableFilter &&)=default
 
virtual ~SeparableFilter ()
 
virtual void Clear ()
 
virtual SeparableFilterClone () const
 
coefficient_vector ColFilter () const
 
coefficient_vector ColumnFilter () const
 
coefficient_vector Filter (int phase) const
 
bool IsEmpty () const
 
bool IsHighPassFilter () const
 
String Name () const
 
SeparableFilteroperator= (const coefficient &x)
 
SeparableFilteroperator= (const SeparableFilter &)=default
 
SeparableFilteroperator= (SeparableFilter &&)=default
 
bool operator== (const SeparableFilter &f) const
 
virtual void Rename (const String &newName)
 
virtual void Resize (int n)
 
coefficient_vector RowFilter () const
 
bool SameCoefficients (const SeparableFilter &f) const
 
int Size () const
 
double Weight () const
 

Detailed Description

SeparableFilter stores two one-dimensional filter vectors of floating point filter coefficients, plus an optional filter name. This class provides automatic allocation and deallocation of coefficients, implicit data sharing, thread-safe access and a number of utility functions for filter management.

In the same way as the KernelFilter and Convolution PCL classes, SeparableFilter can be used with the SeparableConvolution class. In, addition, ATrousWaveletTransform also accepts a SeparableFilter as the implementation of a wavelet scaling function.

The SeparableConvolution PCL class uses separable filters to implement a separable convolution algorithm. This allows for important performance improvements, since separable convolution has O(N*n) complexity, as opposed to O(N*n^2) for non-separable convolution.

See also
SeparableConvolution, ATrousWaveletTransform, KernelFilter

Definition at line 89 of file SeparableFilter.h.

Member Typedef Documentation

◆ coefficient

Represents a filter coefficient.

Definition at line 96 of file SeparableFilter.h.

◆ coefficient_matrix

Represents a two-dimensional filter matrix.

Definition at line 106 of file SeparableFilter.h.

◆ coefficient_vector

Represents a one-dimensional filter.

Definition at line 101 of file SeparableFilter.h.

Constructor & Destructor Documentation

◆ SeparableFilter() [1/7]

pcl::SeparableFilter::SeparableFilter ( const String name = String())
inline

Constructs an empty SeparableFilter object with optional name.

Definition at line 111 of file SeparableFilter.h.

◆ SeparableFilter() [2/7]

pcl::SeparableFilter::SeparableFilter ( int  n,
const String name = String() 
)
inline

Constructs a SeparableFilter object with the specified size n and optional name. Filter elements are not initialized, so they will contain unpredictable values.

A SeparableFilter object must be initialized with either a zero size (which yields an empty filter), or an odd size >= 3.

Definition at line 124 of file SeparableFilter.h.

◆ SeparableFilter() [3/7]

template<typename T >
pcl::SeparableFilter::SeparableFilter ( int  n,
const T &  x,
const String name = String() 
)
inline

Constructs a SeparableFilter object with the specified size n, initial element value x, and optional name.

This constructor yields a separable filter corresponding to a box average two-dimentional filter whose weight is x.

Definition at line 141 of file SeparableFilter.h.

◆ SeparableFilter() [4/7]

pcl::SeparableFilter::SeparableFilter ( const coefficient_vector h,
const coefficient_vector v,
const String name = String() 
)
inline

Constructs a SeparableFilter object with the specified one-dimensional row and column filter vectors h and v, respectively, and an optional name.

Definition at line 155 of file SeparableFilter.h.

◆ SeparableFilter() [5/7]

template<typename T >
pcl::SeparableFilter::SeparableFilter ( const T *  h,
const T *  v,
int  n,
const String name = String() 
)
inline

Constructs a SeparableFilter object with the specified size n and optional name. Copies n filter coefficients from the specified static arrays h and v to the one-dimensional row and column filter vectors in this object, respectively.

Definition at line 172 of file SeparableFilter.h.

◆ SeparableFilter() [6/7]

pcl::SeparableFilter::SeparableFilter ( const SeparableFilter )
default

Copy constructor.

◆ SeparableFilter() [7/7]

pcl::SeparableFilter::SeparableFilter ( SeparableFilter &&  )
default

Move constructor.

◆ ~SeparableFilter()

virtual pcl::SeparableFilter::~SeparableFilter ( )
inlinevirtual

Virtual destructor.

Definition at line 194 of file SeparableFilter.h.

Member Function Documentation

◆ Clear()

virtual void pcl::SeparableFilter::Clear ( )
inlinevirtual

Deallocates filter coefficients and yields an empy SeparableFilter object. This member function does not change the current filter name.

Definition at line 372 of file SeparableFilter.h.

◆ Clone()

virtual SeparableFilter* pcl::SeparableFilter::Clone ( ) const
inlinevirtual

Returns a pointer to a dynamically allocated duplicate of this separable filter.

Note
All derived classes from SeparableFilter must reimplement this virtual member function.

Definition at line 205 of file SeparableFilter.h.

Referenced by pcl::ATrousWaveletTransform::WaveletScalingFunction::WaveletScalingFunction(), pcl::ATrousWaveletTransform::WaveletScalingFunction::Set(), and pcl::SeparableConvolution::SetFilter().

◆ ColFilter()

coefficient_vector pcl::SeparableFilter::ColFilter ( ) const
inline

This member function is an alias to ColumnFilter().

Definition at line 308 of file SeparableFilter.h.

◆ ColumnFilter()

coefficient_vector pcl::SeparableFilter::ColumnFilter ( ) const
inline

Returns a copy of the internal one-dimensional column filter vector.

Definition at line 300 of file SeparableFilter.h.

◆ Filter()

coefficient_vector pcl::SeparableFilter::Filter ( int  phase) const
inline

Returns a copy of the internal one-dimensional filter vector corresponding to the specified phase. If phase is zero, the row filter vector is returned; otherwise the column filter vector is returned.

Definition at line 318 of file SeparableFilter.h.

◆ IsEmpty()

bool pcl::SeparableFilter::IsEmpty ( ) const
inline

Returns true iff this is an empy filter, i.e. if it has no coefficients.

Definition at line 284 of file SeparableFilter.h.

◆ IsHighPassFilter()

bool pcl::SeparableFilter::IsHighPassFilter ( ) const
inline

Returns true if this is a high-pass separable filter; false if this is a low-pass separable filter.

A high-pass kernel filter has one or more negative coefficients. A low-pass kernel filter is either empty or all of its coefficients are positive or zero. For separable low-pass filters, all the nonzero coefficients in both the row and column filter vectors have the same sign. If this condition doesn't hold (i.e. if coefficient signs differ) then the object is a high-pass filter.

Definition at line 343 of file SeparableFilter.h.

◆ Name()

String pcl::SeparableFilter::Name ( ) const
inline

Returns the name of this SeparableFilter object.

Definition at line 244 of file SeparableFilter.h.

Referenced by operator==().

◆ operator=() [1/3]

SeparableFilter& pcl::SeparableFilter::operator= ( const coefficient x)
inline

Assigns the specified scalar x to all filter coefficients. Returns a reference to this object.

Definition at line 224 of file SeparableFilter.h.

◆ operator=() [2/3]

SeparableFilter& pcl::SeparableFilter::operator= ( const SeparableFilter )
default

Copy assignment operator. Returns a reference to this object.

◆ operator=() [3/3]

SeparableFilter& pcl::SeparableFilter::operator= ( SeparableFilter &&  )
default

Move assignment operator. Returns a reference to this object.

◆ operator==()

bool pcl::SeparableFilter::operator== ( const SeparableFilter f) const
inline

Returns true iff this SeparableFilter object is equal to another instance f. Two SeparableFilter instances are equal if their name and filter coefficients are equal.

Definition at line 236 of file SeparableFilter.h.

References Name(), and pcl::ColorSpace::Name().

◆ Rename()

virtual void pcl::SeparableFilter::Rename ( const String newName)
inlinevirtual

Sets the name of this SeparableFilter object.

Definition at line 252 of file SeparableFilter.h.

◆ Resize()

virtual void pcl::SeparableFilter::Resize ( int  n)
inlinevirtual

Sets the size of this separable filter. Previous filter contents are lost; the internal filter coefficient vectors will contain unpredictable values after calling this function.

Definition at line 271 of file SeparableFilter.h.

◆ RowFilter()

coefficient_vector pcl::SeparableFilter::RowFilter ( ) const
inline

Returns a copy of the internal one-dimensional row filter vector.

Definition at line 292 of file SeparableFilter.h.

◆ SameCoefficients()

bool pcl::SeparableFilter::SameCoefficients ( const SeparableFilter f) const
inline

Returns true iff this SeparableFilter object has the same filter coefficients as another instance f.

Definition at line 363 of file SeparableFilter.h.

◆ Size()

int pcl::SeparableFilter::Size ( ) const
inline

Returns the size of this separable filter. The filter size is the length of the one-dimensional row and column filter vectors.

Definition at line 261 of file SeparableFilter.h.

◆ Weight()

double pcl::SeparableFilter::Weight ( ) const
inline

Returns the weight of this separable filter. The weight is equal to the product of the sums of components in the row and column filter vectors.

Definition at line 327 of file SeparableFilter.h.


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