latest version v1.9 - last update 10 Apr 2010 |
Convolution functor. More...
#include <ltiConvolution.h>
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 |
convolution & | copy (const convolution &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
void | setKernel (const mathObject &aKernel) |
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:
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);
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.
aKernel | kernel object with which you want to convolve. | |
boundary | Boundary assumption (Zero, Mirror, Periodic, Constant or NoBoundary). |
lti::convolution::convolution | ( | const convolution & | other | ) |
copy constructor
other | the other functor to be copied |
virtual lti::convolution::~convolution | ( | ) | [virtual] |
destructor
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.
srcdest | image to be filtered. The result is left here too. |
Reimplemented from lti::modifier.
Split the given color image in its RGB components, filter each of them (as lti::channel) and merge the results.
Reimplemented from lti::modifier.
operates on a copy of the given parameters.
src | dvector with the source data. | |
dest | dvector where the result will be left. |
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.
src | vector<channel::value_type> with the source data. | |
dest | vector<channel::value_type> where the result will be left. |
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.
src | vector<channel8::value_type> with the source data. | |
dest | vector<channel8::value_type> where the result will be left. |
operates on a copy of the given parameters.
src | dmatrix with the source data. | |
dest | dmatrix where the result will be left. |
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.
src | matrix<channel::value_type> with the source data. | |
dest | matrix<channel::value_type> where the result will be left. |
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.
src | matrix<channel8::value_type> with the source data. | |
dest | matrix<channel8::value_type> where the result will be left. |
Reimplemented from lti::modifier.
bool lti::convolution::apply | ( | dvector & | srcdest | ) | const |
operates on the given parameter.
srcdest | dvector with the source data. The result will be left here too. |
bool lti::convolution::apply | ( | vector< channel::value_type > & | srcdest | ) | const |
operates on the given parameter.
srcdest | vector<channel::value_type> with the source data. The result will be left here too. |
Reimplemented from lti::modifier.
bool lti::convolution::apply | ( | vector< channel8::value_type > & | srcdest | ) | const |
operates on the given parameter.
srcdest | vector<channel8::value_type> with the source data. The result will be left here too. |
bool lti::convolution::apply | ( | dmatrix & | srcdest | ) | const |
operates on the given parameter.
srcdest | dmatrix with the source data. The result will be left here too. |
bool lti::convolution::apply | ( | matrix< channel::value_type > & | srcdest | ) | const [virtual] |
operates on the given parameter.
srcdest | channel with the source data. The result will be left here too. |
Reimplemented from lti::modifier.
bool lti::convolution::apply | ( | matrix< channel8::value_type > & | srcdest | ) | const [virtual] |
operates on the given parameter.
srcdest | channel8 with the source data. The result will be left here too. |
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.