LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::convolution Class Reference
[Linear filtering]

Convolution functor. More...

#include <ltiConvolution.h>

Inheritance diagram for lti::convolution:
Inheritance graph
[legend]
Collaboration diagram for lti::convolution:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 parameters of the lti::convolution functor More...

Public Member Functions

 convolution ()
 convolution (const parameters &par)
 convolution (const mathObject &aKernel, const eBoundaryType &boundary=Zero)
 convolution (const convolution &other)
virtual ~convolution ()
virtual const char * getTypeName () const
bool apply (matrix< channel8::value_type > &srcdest) const
bool apply (matrix< channel::value_type > &srcdest) const
bool apply (dmatrix &srcdest) const
bool apply (vector< channel8::value_type > &srcdest) const
bool apply (vector< channel::value_type > &srcdest) const
bool apply (dvector &srcdest) const
bool apply (const matrix< channel8::value_type > &src, matrix< channel8::value_type > &dest) const
bool apply (const matrix< channel::value_type > &src, matrix< channel::value_type > &dest) const
bool apply (const dmatrix &src, dmatrix &dest) const
bool apply (const vector< channel8::value_type > &src, vector< channel8::value_type > &dest) const
bool apply (const vector< channel::value_type > &src, vector< channel::value_type > &dest) const
bool apply (const dvector &src, dvector &dest) const
bool apply (const image &src, image &dest) const
bool apply (image &srcdest) const
convolutioncopy (const convolution &other)
virtual functorclone () const
const parametersgetParameters () const
void setKernel (const mathObject &aKernel)

Detailed Description

Convolution functor.

This functor convolves a filter kernel (given in the convolution::parameters) with a vector or matrix.

The kernel must be have of the kernel types provided by the library:

See also:
lti::gaussKernel1D, lti::gaussKernel2D, lti::gaborKernel

Even if the setKernel() method accepts lti::mathObject objects, only the previous ones are accepted.

In the normal case, the type of the filter kernel has to be the same as the type of the channel (or matrix) to be filter. For example, if you want to filter a channel (of floats) you will require a kernel of floats.

If you try to use different types for the kernel and the matrix, this functor will try to cast the kernel to the proper type first (and this will take some time).

For the convolution of kernels and matrices (or channels) of fixed point types (e.g. channel8), you must make use of the norm-term in the kernel. (see kernel1D<T>::norm).

Note that the convolution with sepKernels that are symmetric, e.g gaussKernel2D or anti-symmetric like the gradient part of sobelKernelX is optimized. It is assumed (by definition) that the middle element of an anti-symmetric kernel is 0.

Example using a gaussian kernel

 // the channel to be filtered:
 lti::channel data,result;

 // ... initialize channel here ...

 // gauss filter kernel with dimensions 5x5, and a variance of 1.3
 lti::gaussKernel2D<lti::channel::value_type> kernel(5,1.3);

 lti::convolution filter;                        // convolution operator
 lti::convolution::parameters param;             // parameters
 param.setKernel(kernel);                        // use the gauss kernel
 filter.setParameters(param);                    // use given parameters

 // filter the channel and leave the result there too
 filter.apply(data);

You can also create the functor with a given filter kernel:

 lti::convolution filter(lti::gaussKernel2D<lti::channel::value_type>(5,1.3);
 filter.apply(data); // parameters already set in the constructor!

The filter kernel can also be change, changing the parameters or with the shortcut setKernel():

 param.setKernel(anotherKernel);
 filter.setParamters(param);

 // this is equivalent to:

 filter.setKernel(anotherKernel);

Constructor & Destructor Documentation

lti::convolution::convolution (  ) 

default constructor

lti::convolution::convolution ( const parameters par  ) 

default constructor with parameters

lti::convolution::convolution ( const mathObject aKernel,
const eBoundaryType boundary = Zero 
)

construct a convolution functor with a parameters set which includes the given filter kernel.

Parameters:
aKernel kernel object with which you want to convolve.
boundary Boundary assumption (Zero, Mirror, Periodic, Constant or NoBoundary).
See also:
eBoundaryType
lti::convolution::convolution ( const convolution other  ) 

copy constructor

Parameters:
other the other functor to be copied
virtual lti::convolution::~convolution (  )  [virtual]

destructor


Member Function Documentation

bool lti::convolution::apply ( image srcdest  )  const [virtual]

Split the given color image in its RGB components, filter each of them (as lti::channel) and merge the results.

Parameters:
srcdest image to be filtered. The result is left here too.
Returns:
true if successful, false otherwise

Reimplemented from lti::modifier.

bool lti::convolution::apply ( const image src,
image dest 
) const [virtual]

Split the given color image in its RGB components, filter each of them (as lti::channel) and merge the results.

Parameters:
src image to be filtered.
dest resulting filtered image.
Returns:
true if successful, false otherwise

Reimplemented from lti::modifier.

bool lti::convolution::apply ( const dvector src,
dvector dest 
) const

operates on a copy of the given parameters.

Parameters:
src dvector with the source data.
dest dvector where the result will be left.
Returns:
true if successful, false otherwise.
bool lti::convolution::apply ( const vector< channel::value_type > &  src,
vector< channel::value_type > &  dest 
) const [virtual]

operates on a copy of the given parameters.

Parameters:
src vector<channel::value_type> with the source data.
dest vector<channel::value_type> where the result will be left.
Returns:
true if successful, false otherwise.

Reimplemented from lti::modifier.

bool lti::convolution::apply ( const vector< channel8::value_type > &  src,
vector< channel8::value_type > &  dest 
) const

operates on a copy of the given parameters.

Parameters:
src vector<channel8::value_type> with the source data.
dest vector<channel8::value_type> where the result will be left.
Returns:
true if successful, false otherwise.
bool lti::convolution::apply ( const dmatrix src,
dmatrix dest 
) const

operates on a copy of the given parameters.

Parameters:
src dmatrix with the source data.
dest dmatrix where the result will be left.
Returns:
true if successful, false otherwise.
bool lti::convolution::apply ( const matrix< channel::value_type > &  src,
matrix< channel::value_type > &  dest 
) const [virtual]

operates on a copy of the given parameters.

Parameters:
src matrix<channel::value_type> with the source data.
dest matrix<channel::value_type> where the result will be left.
Returns:
true if successful, false otherwise.

Reimplemented from lti::modifier.

bool lti::convolution::apply ( const matrix< channel8::value_type > &  src,
matrix< channel8::value_type > &  dest 
) const [virtual]

operates on a copy of the given parameters.

Parameters:
src matrix<channel8::value_type> with the source data.
dest matrix<channel8::value_type> where the result will be left.
Returns:
true if successful, false otherwise.

Reimplemented from lti::modifier.

bool lti::convolution::apply ( dvector srcdest  )  const

operates on the given parameter.

Parameters:
srcdest dvector with the source data. The result will be left here too.
Returns:
true if successful, false otherwise.
bool lti::convolution::apply ( vector< channel::value_type > &  srcdest  )  const

operates on the given parameter.

Parameters:
srcdest vector<channel::value_type> with the source data. The result will be left here too.
Returns:
true if successful, false otherwise.

Reimplemented from lti::modifier.

bool lti::convolution::apply ( vector< channel8::value_type > &  srcdest  )  const

operates on the given parameter.

Parameters:
srcdest vector<channel8::value_type> with the source data. The result will be left here too.
Returns:
true if successful, false otherwise.
bool lti::convolution::apply ( dmatrix srcdest  )  const

operates on the given parameter.

Parameters:
srcdest dmatrix with the source data. The result will be left here too.
Returns:
true if successful, false otherwise.
bool lti::convolution::apply ( matrix< channel::value_type > &  srcdest  )  const [virtual]

operates on the given parameter.

Parameters:
srcdest channel with the source data. The result will be left here too.
Returns:
true if successful, false otherwise.

Reimplemented from lti::modifier.

bool lti::convolution::apply ( matrix< channel8::value_type > &  srcdest  )  const [virtual]

operates on the given parameter.

Parameters:
srcdest channel8 with the source data. The result will be left here too.
Returns:
true if successful, false otherwise.

Reimplemented from lti::modifier.

virtual functor* lti::convolution::clone (  )  const [virtual]

returns a pointer to a clone of the functor.

Implements lti::functor.

convolution& lti::convolution::copy ( const convolution other  ) 

copy data of "other" functor.

Reimplemented from lti::functor.

const parameters& lti::convolution::getParameters (  )  const

returns used parameters

Reimplemented from lti::modifier.

virtual const char* lti::convolution::getTypeName (  )  const [virtual]

returns the name of this type

Reimplemented from lti::modifier.

void lti::convolution::setKernel ( const mathObject aKernel  ) 

shortcut to set the filter kernel in the functor parameters.

The other parameters remain unchanged.


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

Generated on Sat Apr 10 15:27:10 2010 for LTI-Lib by Doxygen 1.6.1