PCL
|
Two dimensional Lanczos interpolation algorithm. More...
#include <LanczosInterpolation.h>
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 |
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.
Definition at line 149 of file LanczosInterpolation.h.
|
inline |
Constructs a LanczosInterpolation instance.
n | Filter 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. |
clamp | Clamping 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. |
useLUT | If 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.
|
default |
Copy constructor.
|
inlineoverride |
Destroys a LanczosInterpolation object.
Definition at line 217 of file LanczosInterpolation.h.
|
inlinenoexcept |
Returns the current clamping threshold for this object.
See the documentation for SetClampingThreshold( float ) for a detailed description of the clamping mechanism.
Definition at line 394 of file LanczosInterpolation.h.
|
inlinenoexcept |
Disables (or enables) the interpolation clamping feature.
Definition at line 381 of file LanczosInterpolation.h.
|
inlinenoexcept |
Enables (or disables) the interpolation clamping feature.
Definition at line 371 of file LanczosInterpolation.h.
|
inlinenoexcept |
Returns true iff the interpolation clamping feature has been enabled for this object.
Definition at line 361 of file LanczosInterpolation.h.
|
inlineoverridevirtual |
Interpolated value at {x,y} location.
x,y | Coordinates of the interpolation point (horizontal, vertical). |
Implements pcl::BidimensionalInterpolation< T >.
Definition at line 227 of file LanczosInterpolation.h.
|
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.
Definition at line 419 of file LanczosInterpolation.h.
References pcl::Range().