PCL
pcl::FFTConvolution Class Reference

Fourier-based two-dimensional convolution in the spatial domain. More...

#include <FFTConvolution.h>

+ Inheritance diagram for pcl::FFTConvolution:

Public Member Functions

 FFTConvolution ()=default
 
 FFTConvolution (const FFTConvolution &x)
 
 FFTConvolution (const ImageVariant &f)
 
 FFTConvolution (const KernelFilter &filter)
 
 FFTConvolution (FFTConvolution &&)=default
 
 ~FFTConvolution () override
 
void EnableMagnitudeOutput (bool enable=true)
 
void EnableRealComponentOutput (bool enable=true)
 
const KernelFilterFilter () const
 
const ImageVariantFilterImage () const
 
bool IsMagnitudeOutputEnabled () const
 
bool IsRealComponentOutputEnabled () const
 
FFTConvolutionoperator= (const FFTConvolution &x)
 
FFTConvolutionoperator= (FFTConvolution &&)=default
 
const ComplexImageResponseFunctionDFT () const
 
void SetFilter (const ImageVariant &filter)
 
void SetFilter (const KernelFilter &filter)
 
bool UsingFilter () const
 
- Public Member Functions inherited from pcl::ImageTransformation
 ImageTransformation ()=default
 
 ImageTransformation (const ImageTransformation &)=default
 
virtual ~ImageTransformation ()
 
template<class P >
GenericImage< P > & operator>> (GenericImage< P > &image) const
 
ImageVariantoperator>> (ImageVariant &image) const
 
- Public Member Functions inherited from pcl::ParallelProcess
 ParallelProcess ()=default
 
 ParallelProcess (const ParallelProcess &)=default
 
virtual ~ParallelProcess ()
 
void DisableParallelProcessing (bool disable=true) noexcept
 
void EnableParallelProcessing (bool enable=true, int maxProcessors=0) noexcept
 
bool IsParallelProcessingEnabled () const noexcept
 
int MaxProcessors () const noexcept
 
ParallelProcessoperator= (const ParallelProcess &)=default
 
void SetMaxProcessors (int maxProcessors) noexcept
 
void Swap (ParallelProcess &process) noexcept
 

Static Public Member Functions

static constexpr int FasterThanNonseparableFilterSize (int numThreads)
 
static constexpr int FasterThanSeparableFilterSize (int numThreads)
 

Protected Member Functions

void Apply (pcl::ComplexImage &) const override
 
void Apply (pcl::DComplexImage &) const override
 
void Apply (pcl::DImage &) const override
 
void Apply (pcl::Image &) const override
 
void Apply (pcl::UInt16Image &) const override
 
void Apply (pcl::UInt32Image &) const override
 
void Apply (pcl::UInt8Image &) const override
 

Detailed Description

FFTConvolution implements a fully multithreaded, two-dimensional discrete convolution algorithm via fast Fourier transforms. It performs automatic fixing of border artifacts by applying Neumann boundary conditions (mirroring), and is able to convolve images and response functions of arbitrary sizes, only limited by the available memory.

See also
Convolution, SeparableConvolution

Definition at line 87 of file FFTConvolution.h.

Constructor & Destructor Documentation

◆ FFTConvolution() [1/5]

pcl::FFTConvolution::FFTConvolution ( )
default

Default constructor.

Note
This constructor yields an uninitialized instance that cannot be used before explicit association with a response function, specified either as a KernelFilter object or as an ImageVariant.

◆ FFTConvolution() [2/5]

pcl::FFTConvolution::FFTConvolution ( const KernelFilter filter)
inline

Constructs an FFTConvolution instance with the specified kernel filter.

Parameters
filterResponse function, or convolution filter. The specified object does not have to remain valid while this FFTConvolution instance is actively used, since it owns a private copy of the filter (note that KernelFilter is a reference-counted class).

Definition at line 109 of file FFTConvolution.h.

◆ FFTConvolution() [3/5]

pcl::FFTConvolution::FFTConvolution ( const ImageVariant f)
inline

Constructs an FFTConvolution instance with the specified response function image.

Parameters
fA reference to an ImageVariant whose transported image is the response function, or convolution filter. The transported image must remain valid while this FFTConvolution instance is actively used, or until a new response function is associated with this instance. The specified ImageVariant doesn't have to remain valid, since a FFTConvolution instance owns a private ImageVariant that transports the response function image.

Definition at line 128 of file FFTConvolution.h.

◆ FFTConvolution() [4/5]

pcl::FFTConvolution::FFTConvolution ( const FFTConvolution x)
inline

Copy constructor.

Definition at line 137 of file FFTConvolution.h.

◆ FFTConvolution() [5/5]

pcl::FFTConvolution::FFTConvolution ( FFTConvolution &&  )
default

Move constructor.

◆ ~FFTConvolution()

pcl::FFTConvolution::~FFTConvolution ( )
inlineoverride

Destroys an FFTConvolution object.

Definition at line 155 of file FFTConvolution.h.

Member Function Documentation

◆ Apply() [1/7]

void pcl::FFTConvolution::Apply ( pcl::ComplexImage image) const
overrideprotectedvirtual

Applies this transformation to a 32-bit complex image.

Reimplemented from pcl::ImageTransformation.

◆ Apply() [2/7]

void pcl::FFTConvolution::Apply ( pcl::DComplexImage image) const
overrideprotectedvirtual

Applies this transformation to a 64-bit complex image.

Reimplemented from pcl::ImageTransformation.

◆ Apply() [3/7]

void pcl::FFTConvolution::Apply ( pcl::DImage image) const
overrideprotectedvirtual

Applies this transformation to a 64-bit floating point image.

Reimplemented from pcl::ImageTransformation.

◆ Apply() [4/7]

void pcl::FFTConvolution::Apply ( pcl::Image image) const
overrideprotectedvirtual

Applies this transformation to a 32-bit floating point image.

Reimplemented from pcl::ImageTransformation.

◆ Apply() [5/7]

void pcl::FFTConvolution::Apply ( pcl::UInt16Image image) const
overrideprotectedvirtual

Applies this transformation to a 16-bit unsigned integer image.

Reimplemented from pcl::ImageTransformation.

◆ Apply() [6/7]

void pcl::FFTConvolution::Apply ( pcl::UInt32Image image) const
overrideprotectedvirtual

Applies this transformation to a 32-bit unsigned integer image.

Reimplemented from pcl::ImageTransformation.

◆ Apply() [7/7]

void pcl::FFTConvolution::Apply ( pcl::UInt8Image image) const
overrideprotectedvirtual

Applies this transformation to an 8-bit unsigned integer image.

Reimplemented from pcl::ImageTransformation.

◆ EnableMagnitudeOutput()

void pcl::FFTConvolution::EnableMagnitudeOutput ( bool  enable = true)
inline

Causes this object to apply to real images by storing the magnitude of the complex convolution result. This is the default behavior.

See also
IsMagnitudeOutputEnabled(), EnableRealComponentOutput()

Definition at line 325 of file FFTConvolution.h.

◆ EnableRealComponentOutput()

void pcl::FFTConvolution::EnableRealComponentOutput ( bool  enable = true)
inline

Causes this object to apply to real images by copying the real component of the complex convolved result.

See also
IsRealComponentOutputEnabled(), EnableMagnitudeOutput()

Definition at line 314 of file FFTConvolution.h.

◆ Filter()

const KernelFilter& pcl::FFTConvolution::Filter ( ) const
inline

Returns a reference to the kernel filter currently associated with this FFTConvolution object. If this object does not use a kernel filter, either because it uses an image as its response function, or because this object has not been initialized, the returned filter is empty (i.e., it has no filter coefficients and zero dimensions).

Definition at line 199 of file FFTConvolution.h.

◆ FilterImage()

const ImageVariant& pcl::FFTConvolution::FilterImage ( ) const
inline

Returns a reference to the filter image currently associated with this FFTConvolution object. The referenced ImageVariant object will transport no image if this object does not use a filter image, either because it uses a kernel filter as its response function, or because this object has not been initialized.

The response function is actually the image transported by the returned ImageVariant. It can be an image of any supported data type.

Definition at line 215 of file FFTConvolution.h.

◆ IsMagnitudeOutputEnabled()

bool pcl::FFTConvolution::IsMagnitudeOutputEnabled ( ) const
inline

Returns true if this object applies to real images by storing the magnitude of the complex convolution result. This is the default behavior.

Returns false if this object applies to real images by copying the real component of the complex convolved result.

See also
IsRealComponentOutputEnabled(), EnableMagnitudeOutput()

Definition at line 303 of file FFTConvolution.h.

◆ IsRealComponentOutputEnabled()

bool pcl::FFTConvolution::IsRealComponentOutputEnabled ( ) const
inline

Returns true if this object applies to real images by copying the real component of the complex convolved result.

Returns false if this object applies to real images by storing the magnitude of the complex convolution result. This is the default behavior.

See also
IsMagnitudeOutputEnabled(), EnableRealComponentOutput()

Definition at line 288 of file FFTConvolution.h.

◆ operator=() [1/2]

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

Copy assignment operator. Returns a reference to this object.

Definition at line 162 of file FFTConvolution.h.

◆ operator=() [2/2]

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

Move assignment operator. Returns a reference to this object.

◆ ResponseFunctionDFT()

const ComplexImage* pcl::FFTConvolution::ResponseFunctionDFT ( ) const
inline

Returns a pointer to the discrete Fourier transform (DFT) of the complex response function used internally by this FFTConvolution object, or nullptr if the response function has not been created yet.

The internal DFT of the response function is created and initialized the first time this FFTConvolution object is used to perform a convolution. It is reused to save memory and CPU resources, as long as successive transformations apply to target images with the same dimensions, or otherwise it is re-created on the fly, as necessary. It is destroyed when a new filter is associated with this object.

This function returns a pointer to a complex image that stores the DFT of the original filter after transforming it to wrap around order. This means that the original filter data has been splitted, mirrored, and redistributed to occupy the four corners of the complex 2-D matrix prior to calculating its DFT.

If this object has not been initialized, the returned pointer is nullptr.

Definition at line 273 of file FFTConvolution.h.

◆ SetFilter() [1/2]

void pcl::FFTConvolution::SetFilter ( const ImageVariant filter)
inline

Sets a new filter image as the response function to be applied by this FFTConvolution object.

The image transported by the specified ImageVariant must remain valid while this FFTConvolution instance is actively used, or until a new response function is associated with this instance. The ImageVariant doesn't have to remain valid, since this object owns a private ImageVariant that transports the response function image.

Definition at line 245 of file FFTConvolution.h.

◆ SetFilter() [2/2]

void pcl::FFTConvolution::SetFilter ( const KernelFilter filter)
inline

Sets a new kernel filter as the response function to be applied by this FFTConvolution object.

The specified object does not have to remain valid while this FFTConvolution instance is actively used, since it owns a private copy of the filter (note that KernelFilter is a reference-counted class).

Definition at line 228 of file FFTConvolution.h.

References pcl::KernelFilter::Clone().

◆ UsingFilter()

bool pcl::FFTConvolution::UsingFilter ( ) const
inline

Returns true if this FFTConvolution uses a KernelFilter object as its response function; false if it uses an image.

Definition at line 187 of file FFTConvolution.h.


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