latest version v1.9 - last update 10 Apr 2010 |
This modifier is used to convolve individual points of a given channel with a arbitrary kernel2D<float> (e.g. More...
#include <ltiSelective2DConvolution.h>
Classes | |
class | parameters |
the parameters for the class selective2DConvolution More... | |
Public Member Functions | |
selective2DConvolution () | |
selective2DConvolution (const parameters &par) | |
selective2DConvolution (const kernel2D< float > &aKernel) | |
selective2DConvolution (const selective2DConvolution &other) | |
virtual | ~selective2DConvolution () |
virtual const char * | getTypeName () const |
bool | apply (const channel &src, channel &dest, const channel &mask) const |
bool | apply (const channel &src, float &result, const int row, const int column) const |
bool | apply (const channel &src, channel &dest, const int row, const int column) const |
bool | apply (const channel &src, float &result, const point &thePoint) const |
bool | apply (const channel &src, channel &dest, const point &thePoint) const |
bool | apply (const channel &src, channel &dest, const pointList &thePointList) const |
selective2DConvolution & | copy (const selective2DConvolution &other) |
selective2DConvolution & | operator= (const selective2DConvolution &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
void | setKernel2D (const kernel2D< float > &aKernel) |
This modifier is used to convolve individual points of a given channel with a arbitrary kernel2D<float> (e.g.
a gaussian kernel like the one in "ltiGaussKernels.h").
The points to be convolved may be given in a mask channel, as pointList, or as individual points.
TODO: The boundaryType is not checked yet!!! Border points cannot and will not be convolved.
Example of determinating the GradX and GradY values for a given channel src using a mask channel:
#include "ltiGradientKernels.h" #include "ltiSelective2DConvolution.h" #include "ltiImage.h" lti::channel src, mask; . . . //Fill mask and src channel as necessary . . . lti::gradientKernelX<float> myKernelX(5); // Optimal Gradient 5x5 kernels lti::gradientKernelY<float> myKernelY(5); // They both are separable. lti::kernel2D<float> myKernel2D; // We need genuine 2D kernels, not separable ones. myKernel2D.castFrom(myKernelX); // So, we create one :-) lti::selective2DConvolution mySelConvX(myKernel2D); myKernel2D.castFrom(myKernelY); lti::selective2DConvolution mySelConvY; mySelConvY.setKernel(myKernel2D); // Another way of setting an arbitrary kernel. lti::channel GradX,GradY; // Where to put the results mySelConvX.apply(src,GradX,mask); // All points in the mask channel having a value mySelConvY.apply(src,GradY,mask); // !=0.0f are being convolved.
Now, we have the results in the GradX and GradY channel.
lti::selective2DConvolution::selective2DConvolution | ( | ) |
default constructor
lti::selective2DConvolution::selective2DConvolution | ( | const parameters & | par | ) |
Construct a functor using the given parameters.
lti::selective2DConvolution::selective2DConvolution | ( | const kernel2D< float > & | aKernel | ) |
Construct a selective2DConvolution functor with a parameters set which includes the given filter kernel.
lti::selective2DConvolution::selective2DConvolution | ( | const selective2DConvolution & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::selective2DConvolution::~selective2DConvolution | ( | ) | [virtual] |
destructor
bool lti::selective2DConvolution::apply | ( | const channel & | src, | |
channel & | dest, | |||
const pointList & | thePointList | |||
) | const |
operates on a copy of the given parameters.
Convolves all points of a pointlist in the source channel with a given kernel. The result will be written into a destination channel.
src | channel with the source data. | |
dest | channel where the result will be left. | |
thePointList | Given pointlist. All points of the list are convolved. |
bool lti::selective2DConvolution::apply | ( | const channel & | src, | |
channel & | dest, | |||
const point & | thePoint | |||
) | const |
operates on a copy of the given parameters.
Convolves only one specific point in the source channel with a given kernel. The result will be written into a destination channel.
src | channel with the source data. | |
thePoint | Convolved point. | |
dest | channel where the result will be left. |
bool lti::selective2DConvolution::apply | ( | const channel & | src, | |
float & | result, | |||
const point & | thePoint | |||
) | const |
operates on a copy of the given parameters.
Convolves only one specific point in the source channel with a given kernel.
src | channel with the source data. | |
result | The result of the convolution can be found here. | |
thePoint | Convolved point. |
bool lti::selective2DConvolution::apply | ( | const channel & | src, | |
channel & | dest, | |||
const int | row, | |||
const int | column | |||
) | const |
operates on a copy of the given parameters.
Convolves only one specific point in the source channel with a given kernel. The result will be written into a destination channel.
src | channel with the source data. | |
column | Column of the convolved point. | |
row | Row of the convolved point | |
dest | channel where the result will be left. |
bool lti::selective2DConvolution::apply | ( | const channel & | src, | |
float & | result, | |||
const int | row, | |||
const int | column | |||
) | const |
operates on a copy of the given parameters.
Convolves only one specific point in the source channel with a given kernel. The result can be found in the result variable.
src | channel with the source data. | |
result | The result of the convolution can be found here. | |
column | Column of the convolved point. | |
row | Row of the convolved point |
bool lti::selective2DConvolution::apply | ( | const channel & | src, | |
channel & | dest, | |||
const channel & | mask | |||
) | const |
operates on a copy of the given parameters.
src | channel with the source data. | |
mask | channel with the mask data. All points in the src channel having a corresponding point in the mask channel with values different from 0 are convolved with the given kernel. | |
dest | channel where the result will be left. |
virtual functor* lti::selective2DConvolution::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Implements lti::functor.
selective2DConvolution& lti::selective2DConvolution::copy | ( | const selective2DConvolution & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::functor.
const parameters& lti::selective2DConvolution::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::modifier.
virtual const char* lti::selective2DConvolution::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("selective2DConvolution")
Reimplemented from lti::modifier.
selective2DConvolution& lti::selective2DConvolution::operator= | ( | const selective2DConvolution & | other | ) |
void lti::selective2DConvolution::setKernel2D | ( | const kernel2D< float > & | aKernel | ) |
shortcut to set the filter kernel2D in the functor parameters.
The other parameters remain unchanged.