PCL
pcl::LanczosInterpolation< T > Class Template Reference

Two dimensional Lanczos interpolation algorithm. More...

#include <LanczosInterpolation.h>

+ Inheritance diagram for pcl::LanczosInterpolation< T >:

Public Member Functions

 LanczosInterpolation (const LanczosInterpolation &)=default
 
 LanczosInterpolation (int n=3, float clamp=__PCL_LANCZOS_CLAMPING_THRESHOLD, bool useLUT=Default::UseLUT((T *) 0))
 
 ~LanczosInterpolation () override
 
float ClampingThreshold () const noexcept
 
void DisableClamping (bool disable=true) noexcept
 
void EnableClamping (bool enable=true) noexcept
 
bool IsClampingEnabled () const noexcept
 
double operator() (double x, double y) const override
 
void SetClampingThreshold (float clamp) noexcept
 
- Public Member Functions inherited from pcl::BidimensionalInterpolation< T >
 BidimensionalInterpolation ()=default
 
 BidimensionalInterpolation (const BidimensionalInterpolation &)=default
 
virtual ~BidimensionalInterpolation ()
 
const T * BeingInterpolated () const
 
double BorderFillValue () const
 
virtual void Clear ()
 
void DisableBorderFilling (bool disable=true)
 
void EnableBorderFilling (bool enable=true)
 
int Height () const
 
virtual void Initialize (const T *data, int width, int height)
 
bool IsBorderFillingEnabled () const
 
void SetBorderFillValue (double v)
 
int Width () const
 

Detailed Description

template<typename T>
class pcl::LanczosInterpolation< T >

This class uses Lanczos filters to interpolate pixel values at arbitrary coordinates within a two-dimensional data matrix. A one-dimensional Lanczos filter of order n is defined by the following equations:

L(x;n) = sinc(x)*sinc(x/n)    for |x| < n
L(x;n) = 0                    for |x| >= n

where sinc() is the normalized sinc function:

sinc(x;n) = 1                 for x = 0
sinc(x;n) = sin(pi*x)/(pi*x)  for x != 0

The Lanczos function has alternating positive and negative lobes toward positive and negative infinity. The order n defines the number of lobes preserved in the interpolation filter function: n=1 only includes the central, positive lobe; n=2 includes the first two lobes (one positive and one negative), and so on. The default filter order is three.

Lanczos interpolation has excellent detail preservation performance with minimal generation of aliasing patterns for noisy data. Its main drawback is generation of strong undershoot (aka ringing) artifacts when negative function lobes fall over bright pixels and edges. This usually happens with linear data. In the current PCL implementation we have included a clamping mechanism that prevents negative interpolated values and ringing problems for most images.

See also
BidimensionalInterpolation, NearestNeighborInterpolation, BilinearInterpolation, BicubicSplineInterpolation, BicubicBSplineInterpolation, BicubicFilterInterpolation, Lanczos3LUTInterpolation, Lanczos4LUTInterpolation, Lanczos5LUTInterpolation

Definition at line 149 of file LanczosInterpolation.h.

Constructor & Destructor Documentation

◆ LanczosInterpolation() [1/2]

template<typename T >
pcl::LanczosInterpolation< T >::LanczosInterpolation ( int  n = 3,
float  clamp = __PCL_LANCZOS_CLAMPING_THRESHOLD,
bool  useLUT = Default::UseLUT( (T*)0 ) 
)
inline

Constructs a LanczosInterpolation instance.

Parameters
nFilter order (n >= 1). The Lanczos filter interpolates from the nearest (2*n)^2 mapped source pixels for each interpolation point. The default filter order is 3, so the interpolation uses a neighborhood of 36 pixels by default.
clampClamping threshold. Clamping is applied to fix undershoot (aka ringing) artifacts. A value of this parameter within the [0,1] range enables clamping: The lower the clamping threshold, the more aggressive deringing effect is achieved. A negative threshold value disables the clamping feature. The default value is 0.3. For more information, refer to the documentation for the SetClampingThreshold( float ) member function.
useLUTIf true, the interpolation will use a precomputed LUT of function values at discrete intervals. This greatly improves performance, increasing execution speed by about a factor of 2. In current PCL versions, the Lanczos functions are sampled at 0.00025 px resolution, which provides an interpolation accuracy of about 1.0e-07. This is valid for interpolation of 32-bit floating point data, but can be insufficient for 32-bit integers and double precision, depending on the application. If this parameter is false, the interpolation will compute actual function values for each interpolation point. This parameter is true by default for the uint8, int8, uint16, int16, and float template specializations; false by default for other types.

Definition at line 197 of file LanczosInterpolation.h.

◆ LanczosInterpolation() [2/2]

template<typename T >
pcl::LanczosInterpolation< T >::LanczosInterpolation ( const LanczosInterpolation< T > &  )
default

Copy constructor.

◆ ~LanczosInterpolation()

template<typename T >
pcl::LanczosInterpolation< T >::~LanczosInterpolation ( )
inlineoverride

Destroys a LanczosInterpolation object.

Definition at line 217 of file LanczosInterpolation.h.

Member Function Documentation

◆ ClampingThreshold()

template<typename T >
float pcl::LanczosInterpolation< T >::ClampingThreshold ( ) const
inlinenoexcept

Returns the current clamping threshold for this object.

See the documentation for SetClampingThreshold( float ) for a detailed description of the clamping mechanism.

See also
SetClampingThreshold(), IsClampingEnabled(), EnableClamping()

Definition at line 394 of file LanczosInterpolation.h.

◆ DisableClamping()

template<typename T >
void pcl::LanczosInterpolation< T >::DisableClamping ( bool  disable = true)
inlinenoexcept

Disables (or enables) the interpolation clamping feature.

See also
IsClampingEnabled(), EnableClamping(), SetClampingThreshold()

Definition at line 381 of file LanczosInterpolation.h.

◆ EnableClamping()

template<typename T >
void pcl::LanczosInterpolation< T >::EnableClamping ( bool  enable = true)
inlinenoexcept

Enables (or disables) the interpolation clamping feature.

See also
IsClampingEnabled(), DisableClamping(), SetClampingThreshold()

Definition at line 371 of file LanczosInterpolation.h.

◆ IsClampingEnabled()

template<typename T >
bool pcl::LanczosInterpolation< T >::IsClampingEnabled ( ) const
inlinenoexcept

Returns true iff the interpolation clamping feature has been enabled for this object.

See also
EnableClamping(), ClampingThreshold()

Definition at line 361 of file LanczosInterpolation.h.

◆ operator()()

template<typename T >
double pcl::LanczosInterpolation< T >::operator() ( double  x,
double  y 
) const
inlineoverridevirtual

Interpolated value at {x,y} location.

Parameters
x,yCoordinates of the interpolation point (horizontal, vertical).

Implements pcl::BidimensionalInterpolation< T >.

Definition at line 227 of file LanczosInterpolation.h.

◆ SetClampingThreshold()

template<typename T >
void pcl::LanczosInterpolation< T >::SetClampingThreshold ( float  clamp)
inlinenoexcept

Defines a threshold to trigger interpolation clamping.

Lanczos interpolation generates strong undershoot (aka ringing) artifacts when the negative lobes of the interpolation function fall over bright isolated pixels or edges. The clamping mechanism acts by limiting the high-pass component of the interpolation filter selectively to fix these problems.

The specified clamping threshold clamp must be in the [0,1] range. Lower values cause a more aggressive deringing effect. Too strong of a clamping threshold can degrade performance of the Lanczos filter to some degree, since it tends to block its high-pass behavior.

Note
The interpolation clamping feature must be enabled for this threshold to have any effect. See the constructor for this class and the documentation for IsClampingEnabled().
See also
ClampingThreshold(), IsClampingEnabled(), EnableClamping()

Definition at line 419 of file LanczosInterpolation.h.

References pcl::Range().


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