PCL
pcl::GaussianFilter Class Reference

A kernel filter implementing a discrete Gaussian distribution in two dimensions. More...

#include <GaussianFilter.h>

+ Inheritance diagram for pcl::GaussianFilter:

Public Member Functions

 GaussianFilter ()=default
 
 GaussianFilter (const GaussianFilter &)=default
 
 GaussianFilter (float sigma, float epsilon, float rho, float theta=0, const String &name=String())
 
 GaussianFilter (float sigma, float epsilon=0.01, const String &name=String())
 
 GaussianFilter (GaussianFilter &&)=default
 
 GaussianFilter (int n, float epsilon, float rho, float theta=0, const String &name=String())
 
 GaussianFilter (int n, float epsilon=0.01, const String &name=String())
 
float AspectRatio () const
 
SeparableFilter AsSeparableFilter (float tolerance=__PCL_DEFAULT_FILTER_SEPARABILITY_TOLERANCE) const override
 
KernelFilterClone () const override
 
double FWHM () const
 
double FWHMx () const
 
double FWHMy () const
 
bool IsSeparable () const override
 
GaussianFilteroperator= (const GaussianFilter &x)
 
GaussianFilteroperator= (GaussianFilter &&x)
 
void Resize (int n) override
 
float RotationAngle () const
 
void Set (float sigma)
 
void Set (float sigma, float epsilon)
 
void Set (float sigma, float epsilon, float rho)
 
void Set (float sigma, float epsilon, float rho, float theta)
 
void SetAspectRatio (float rho)
 
void SetRotationAngle (float theta)
 
void SetSigma (float sigma)
 
void SetTruncation (float epsilon)
 
float Sigma () const
 
float SigmaX () const
 
float SigmaY () const
 
float Truncation () const
 
- Public Member Functions inherited from pcl::KernelFilter
 KernelFilter (const coefficient_matrix &F, const String &name=String())
 
 KernelFilter (const KernelFilter &)=default
 
 KernelFilter (const String &name=String())
 
template<typename T >
 KernelFilter (const T *k, int n, const String &name=String())
 
 KernelFilter (int n, const String &name=String())
 
template<typename T >
 KernelFilter (int n, const T &x, const String &name=String())
 
 KernelFilter (KernelFilter &&)=default
 
virtual ~KernelFilter ()
 
const coefficientBegin () const
 
const coefficientbegin () const
 
virtual void Clear ()
 
coefficient_matrix Coefficients () const
 
const coefficientEnd () const
 
const coefficientend () const
 
void Flip ()
 
KernelFilter Flipped () const
 
bool IsEmpty () const
 
bool IsFlipped () const
 
bool IsHighPassFilter () const
 
double Modulus () const
 
String Name () const
 
void Normalize ()
 
KernelFilter Normalized () const
 
int NumberOfCoefficients () const
 
 operator bool () const
 
KernelFilteroperator= (const coefficient &x)
 
KernelFilteroperator= (const coefficient_matrix &F)
 
KernelFilteroperator= (const KernelFilter &)=default
 
KernelFilteroperator= (KernelFilter &&)=default
 
bool operator== (const KernelFilter &f) const
 
const coefficientoperator[] (int row) const
 
virtual void Rename (const String &newName)
 
bool SameCoefficients (const KernelFilter &f) const
 
int Size () const
 
template<class P >
void ToImage (GenericImage< P > &image) const
 
void ToImage (ImageVariant &v) const
 
double Weight () const
 

Friends

void Swap (GaussianFilter &x1, GaussianFilter &x2)
 

Additional Inherited Members

- Public Types inherited from pcl::KernelFilter
using coefficient = float
 
using coefficient_matrix = GenericMatrix< coefficient >
 

Detailed Description

A GaussianFilter object is a specialized KernelFilter whose elements are calculated as a discrete representation of an elliptical Gaussian function centered at the origin:

G(x,y) = Exp( -( x^2/(2*sx^2) + y^2/(2*sy^2) ) )

where sx and sy are the standard deviations of the Gaussian distribution on the horizontal and vertical axes, respectively.

GaussianFilter also supports arbitrary rotation around the origin. When the filter is rotated, the coordinates x, y in the equation above are replaced by their rotated counterparts.

A GaussianFilter instance is formally defined by the following parameters:

sigma Standard deviation of the filter distribution on the X axis (sigma > 0).
rho The ratio sy/sx (see equation above) of the generated filter distribution (0 <= rho <= 1).
theta Rotation angle of the horizontal axis in radians (0 <= theta < PI). This parameter only makes sense when rho < 1.
epsilon Maximum truncation error of the computed filter coefficients (eps > 0).
See also
KernelFilter, VariableShapeFilter, MoffatFilter, LinearFilter, MeanFilter

Definition at line 97 of file GaussianFilter.h.

Constructor & Destructor Documentation

◆ GaussianFilter() [1/7]

pcl::GaussianFilter::GaussianFilter ( )
default

Constructs an empty GaussianFilter object with default functional parameters: sigma=2, epsilon=0.01, rho=1, theta=0.

◆ GaussianFilter() [2/7]

pcl::GaussianFilter::GaussianFilter ( float  sigma,
float  epsilon = 0.01,
const String name = String() 
)
inline

Constructs a GaussianFilter object given the standard deviation sigma > 0 and truncation error epsilon > 0. Assigns an optional name to the new filter object.

Definition at line 112 of file GaussianFilter.h.

◆ GaussianFilter() [3/7]

pcl::GaussianFilter::GaussianFilter ( float  sigma,
float  epsilon,
float  rho,
float  theta = 0,
const String name = String() 
)
inline

Constructs a GaussianFilter object given the standard deviation sigma > 0, truncation error epsilon > 0, aspect ratio 0 <= rho <= 1, and rotation angle 0 <= theta <= PI in radians. Assigns an optional name to the new filter object.

Definition at line 124 of file GaussianFilter.h.

◆ GaussianFilter() [4/7]

pcl::GaussianFilter::GaussianFilter ( int  n,
float  epsilon = 0.01,
const String name = String() 
)
inline

Constructs a GaussianFilter object given the odd kernel size n >= 3 and truncation error epsilon > 0. Assigns an optional name to the new filter object.

Definition at line 135 of file GaussianFilter.h.

◆ GaussianFilter() [5/7]

pcl::GaussianFilter::GaussianFilter ( int  n,
float  epsilon,
float  rho,
float  theta = 0,
const String name = String() 
)
inline

Constructs a GaussianFilter object given the odd kernel size n >= 3, truncation error epsilon > 0, aspect ratio 0 <= rho <= 1, and rotation angle 0 <= theta <= PI in radians. Assigns an optional name to the new filter object.

Definition at line 147 of file GaussianFilter.h.

◆ GaussianFilter() [6/7]

pcl::GaussianFilter::GaussianFilter ( const GaussianFilter )
default

Copy constructor.

◆ GaussianFilter() [7/7]

pcl::GaussianFilter::GaussianFilter ( GaussianFilter &&  )
default

Move constructor.

Member Function Documentation

◆ AspectRatio()

float pcl::GaussianFilter::AspectRatio ( ) const
inline

Returns the aspect ratio of the filter distribution. This is the ratio vertical:horizontal between filter axes in the range [0,1].

Definition at line 268 of file GaussianFilter.h.

◆ AsSeparableFilter()

SeparableFilter pcl::GaussianFilter::AsSeparableFilter ( float  tolerance = __PCL_DEFAULT_FILTER_SEPARABILITY_TOLERANCE) const
inlineoverridevirtual

Returns a separable filter equivalent to this Gaussian kernel filter.

A Gaussian filter is the only circularly symmetric, two-dimensional separable filter. This reimplementation returns a separable filter only if this object represents an undistorted/unrotated Gaussian function, that is, when its aspect ratio is 1. Otherwise an empty SeparableFilter object is returned since the filter matrix is not separable.

Reimplemented from pcl::KernelFilter.

Definition at line 179 of file GaussianFilter.h.

◆ Clone()

KernelFilter* pcl::GaussianFilter::Clone ( ) const
inlineoverridevirtual

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

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

Reimplemented from pcl::KernelFilter.

Definition at line 165 of file GaussianFilter.h.

◆ FWHM()

double pcl::GaussianFilter::FWHM ( ) const
inline

Returns the full width at half maximum, in sigma units, for the horizontal axis of the elliptical Gaussian filter distribution.

This function is an alias to FWHMx().

Definition at line 309 of file GaussianFilter.h.

◆ FWHMx()

double pcl::GaussianFilter::FWHMx ( ) const
inline

Returns the full width at half maximum (FWHM), in sigma units, for the horizontal axis of the elliptical Gaussian filter distribution.

Definition at line 287 of file GaussianFilter.h.

◆ FWHMy()

double pcl::GaussianFilter::FWHMy ( ) const
inline

Returns the full width at half maximum (FWHM), in sigma units, for the vertical axis of the elliptical Gaussian filter distribution.

Definition at line 297 of file GaussianFilter.h.

◆ IsSeparable()

bool pcl::GaussianFilter::IsSeparable ( ) const
inlineoverridevirtual

Returns true iff this filter is separable,

A Gaussian filter is separable. As reimplemented in GaussianFilter, this member function returns true for undistorted/unrotated Gaussian filters, that is, when this object's aspect ratio is 1.

Reimplemented from pcl::KernelFilter.

Definition at line 196 of file GaussianFilter.h.

◆ operator=() [1/2]

GaussianFilter& pcl::GaussianFilter::operator= ( const GaussianFilter x)
inline

Copy assignment operator. Returns a reference to this object.

Definition at line 204 of file GaussianFilter.h.

◆ operator=() [2/2]

GaussianFilter& pcl::GaussianFilter::operator= ( GaussianFilter &&  x)
inline

Move assignment operator. Returns a reference to this object.

Definition at line 217 of file GaussianFilter.h.

◆ Resize()

void pcl::GaussianFilter::Resize ( int  n)
inlineoverridevirtual

Recalculates filter coefficients for the given odd kernel size n >= 3. This routine computes the required standard deviation to sample the Gaussian function on a matrix of the specified size, preserving the current coefficient truncation, aspect ratio and rotation angle.

Reimplemented from pcl::KernelFilter.

Definition at line 395 of file GaussianFilter.h.

◆ RotationAngle()

float pcl::GaussianFilter::RotationAngle ( ) const
inline

Returns the rotation angle of the filter distribution. This is the rotation angle in radians with respect to the central pixel, in the range [0,+PI].

Definition at line 278 of file GaussianFilter.h.

◆ Set() [1/4]

void pcl::GaussianFilter::Set ( float  sigma)
inline

Recalculates filter coefficients for the specified sigma sigma > 0. The current coefficient truncation error, aspect ratio and rotation angle are not changed.

Definition at line 349 of file GaussianFilter.h.

◆ Set() [2/4]

void pcl::GaussianFilter::Set ( float  sigma,
float  epsilon 
)
inline

Recalculates filter coefficients for the specified sigma sigma > 0 and truncation error epsilon > 0. Does not change the current aspect ratio and rotation angle.

Definition at line 339 of file GaussianFilter.h.

◆ Set() [3/4]

void pcl::GaussianFilter::Set ( float  sigma,
float  epsilon,
float  rho 
)
inline

Recalculates filter coefficients for the specified sigma sigma > 0, truncation error epsilon > 0, and aspect ratio 0 <= rho <= 1. Does not change the current rotation angle.

Definition at line 329 of file GaussianFilter.h.

◆ Set() [4/4]

void pcl::GaussianFilter::Set ( float  sigma,
float  epsilon,
float  rho,
float  theta 
)
inline

Recalculates filter coefficients for the specified sigma sigma > 0, truncation error epsilon > 0, aspect ratio 0 <= rho <= 1, and rotation angle 0 <= theta <= PI in radians.

Definition at line 319 of file GaussianFilter.h.

◆ SetAspectRatio()

void pcl::GaussianFilter::SetAspectRatio ( float  rho)
inline

This is a convenience member function, equivalent to Set( Sigma(), Truncation(), rho ).

Definition at line 375 of file GaussianFilter.h.

◆ SetRotationAngle()

void pcl::GaussianFilter::SetRotationAngle ( float  theta)
inline

This is a convenience member function, equivalent to Set( Sigma(), Truncation(), AspectRatio(), theta ).

Definition at line 384 of file GaussianFilter.h.

◆ SetSigma()

void pcl::GaussianFilter::SetSigma ( float  sigma)
inline

This is a convenience member function, equivalent to Set( sigma ).

Definition at line 357 of file GaussianFilter.h.

◆ SetTruncation()

void pcl::GaussianFilter::SetTruncation ( float  epsilon)
inline

This is a convenience member function, equivalent to Set( Sigma(), epsilon ).

Definition at line 366 of file GaussianFilter.h.

◆ Sigma()

float pcl::GaussianFilter::Sigma ( ) const
inline

Returns the standard deviation of the filter distribution on the X (horizontal) axis.

This function is an alias to SigmaX().

Definition at line 251 of file GaussianFilter.h.

◆ SigmaX()

float pcl::GaussianFilter::SigmaX ( ) const
inline

Returns the standard deviation of the filter distribution on the X (horizontal) axis.

Definition at line 231 of file GaussianFilter.h.

◆ SigmaY()

float pcl::GaussianFilter::SigmaY ( ) const
inline

Returns the standard deviation of the filter distribution on the Y (vertical) axis.

Definition at line 240 of file GaussianFilter.h.

◆ Truncation()

float pcl::GaussianFilter::Truncation ( ) const
inline

Returns the maximum truncation error of the filter coefficients.

Definition at line 259 of file GaussianFilter.h.

Friends And Related Function Documentation

◆ Swap

void Swap ( GaussianFilter x1,
GaussianFilter x2 
)
friend

Exchanges two Gaussian filters x1 and x2.

Definition at line 403 of file GaussianFilter.h.


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