[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]
![]() |
Kernel1D Class Template Reference | ![]() |
---|
Generic 1 dimensional convolution kernel. More...
#include "vigra/separableconvolution.hxx"
Public Types | |
typedef InternalVector::value_type | value_type |
typedef InternalVector::reference | reference |
typedef InternalVector::const_reference | const_reference |
typedef InternalVector::iterator | Iterator |
typedef InternalVector::iterator | iterator |
typedef InternalVector::const_iterator | const_iterator |
typedef StandardAccessor< ARITHTYPE > | Accessor |
typedef StandardConstAccessor< ARITHTYPE > | ConstAccessor |
Public Methods | |
Kernel1D () | |
Kernel1D (Kernel1D const &k) | |
Kernel1D & | operator= (Kernel1D const &k) |
InitProxy | operator= (value_type const &v) |
~Kernel1D () | |
void | initGaussian (double std_dev, value_type norm) |
void | initGaussian (double std_dev) |
void | initDiscreteGaussian (double std_dev, value_type norm) |
void | initDiscreteGaussian (double std_dev) |
void | initGaussianDerivative (double std_dev, int order, value_type norm) |
void | initGaussianDerivative (double std_dev, int order) |
void | initBinomial (int radius, value_type norm) |
void | initBinomial (int radius) |
void | initAveraging (int radius, value_type norm) |
void | initAveraging (int radius) |
void | initSymmetricGradient (value_type norm) |
void | initSymmetricGradient () |
Kernel1D & | initExplicitly (int left, int right) |
iterator | center () |
reference | operator[] (int location) |
int | left () const |
int | right () const |
int | size () const |
BorderTreatmentMode | borderTreatment () const |
void | setBorderTreatment (BorderTreatmentMode new_mode) |
value_type | norm () const |
void | normalize (value_type norm, unsigned int derivativeOrder=0, double offset=0.0) |
void | normalize () |
ConstAccessor | accessor () const |
Accessor | accessor () |
Detailed Description |
This kernel may be used for convolution of 1 dimensional signals or for separable convolution of multidimensional signals.
Convlution functions access the kernel via a 1 dimensional random access iterator which they get by calling center(). This iterator points to the center of the kernel. The kernel's size is given by its left() (<=0) and right() (>= 0) methods. The desired border treatment mode is returned by borderTreatment().
The different init functions create a kernel with the specified properties. The kernel's value_type must be a linear space, i.e. it must define multiplication with doubles and NumericTraits.
The kernel defines a factory function kernel1d() to create an argument object (see Kernel Argument Object Factories).
Usage:
#include "vigra/stdconvolution.hxx"
vigra::FImage src(w,h), dest(w,h); ... // define Gaussian kernel with std. deviation 3.0 vigra::Kernel1D kernel; kernel.initGaussian(3.0); vigra::separableConvolveX(srcImageRange(src), destImage(dest), kernel1d(kernel));
Required Interface:
value_type v = vigra::NumericTraits<value_type>::one(); // if norm is not // given explicitly double d; v = d * v;
pyramid.cxx, and smooth.cxx.
|
the kernel's accessor |
|
const 1D random access iterator over the kernel's values |
|
the kernel's const reference type |
|
the kernel's const accessor |
|
1D random access iterator over the kernel's values |
|
deprecated -- use Kernel1D::iterator |
|
the kernel's reference type |
|
the kernel's value type |
|
Default constructor. Creates a kernel of size 1 which would copy the signal unchanged. |
|
Copy constructor. |
|
Destructor. |
|
get an accessor |
|
get a const accessor |
|
current border treatment mode |
|
Get iterator to center of kernel Postconditions: |
|
Init as a Averaging filter with norm 1. |
|
Init as an Averaging filter. 'norm' denotes the sum of all bins of the kernel. The window size is (2*radius+1) * (2*radius+1) Precondition: radius >= 0 Postconditions: 1. left() == -radius 2. right() == radius 3. borderTreatment() == BORDER_TREATMENT_CLIP 4. norm() == norm |
|
Init as a Binomial filter with norm 1. |
|
Init as a Binomial filter. 'norm' denotes the sum of all bins of the kernel. Precondition: radius >= 0 Postconditions: 1. left() == -radius 2. right() == radius 3. borderTreatment() == BORDER_TREATMENT_REFLECT 4. norm() == norm |
|
Init as a LOineberg's discrete analog of the Gaussian function with norm 1. |
|
Init as Lindeberg's discrete analog of the Gaussian function. The radius of the kernel is always 3*std_dev. 'norm' denotes the sum of all bins of the kernel. Precondition: std_dev >= 0.0 Postconditions: 1. left() == -(int)(3.0*std_dev + 0.5) 2. right() == (int)(3.0*std_dev + 0.5) 3. borderTreatment() == BORDER_TREATMENT_REFLECT 4. norm() == norm |
|
Init the kernel by an explicit initializer list. The left and right boundaries of the kernel must be passed. A comma-separated initializer list is given after the assignment operator. This function is used like this:
// define horizontal Roberts filter vigra::Kernel1D<float> roberts_gradient_x; roberts_gradient_x.initExplicitly(0, 1) = 1.0, -1.0; The norm is set to the sum of the initialzer values. If the wrong number of values is given, a run-time error results. It is, however, possible to give just one initializer. This creates an averaging filter with the given constant:
vigra::Kernel1D<float> average5x1; average5x1.initExplicitly(-2, 2) = 1.0/5.0; Here, the norm is set to value*size(). Preconditions:
1. left <= 0 2. right >= 0 3. the number of values in the initializer list is 1 or equals the size of the kernel.
|
|
Init as a Gaussian function with norm 1. |
|
Init as a sampled Gaussian function. The radius of the kernel is always 3*std_dev. ' Precondition: std_dev >= 0.0 Postconditions: 1. left() == -(int)(3.0*std_dev + 0.5) 2. right() == (int)(3.0*std_dev + 0.5) 3. borderTreatment() == BORDER_TREATMENT_CLIP 4. norm() == norm
|
|
Init as a Gaussian derivative with norm 1. |
|
Init as a Gaussian derivative of order '
![]()
Thus, the kernel will be corrected for the error introduced by windowing the Gaussian to a finite interval. However, if Preconditions: 1. std_dev >= 0.0 2. order >= 1 Postconditions: 1. left() == -(int)(3.0*std_dev + 0.5*order + 0.5) 2. right() == (int)(3.0*std_dev + 0.5*order + 0.5) 3. borderTreatment() == BORDER_TREATMENT_REPEAT 4. norm() == norm |
|
Init as a symmetric gradient filter with norm 1. |
|
Init as a symmetric gradient filter of the form Postconditions: 1. left() == -1 2. right() == 1 3. borderTreatment() == BORDER_TREATMENT_REPEAT 4. norm() == norm |
|
left border of kernel (inclusive), always <= 0 |
|
norm of kernel |
|
normalize kernel to norm 1. |
|
set a new norm and normalize kernel, use the normalization formula for the given derivativeOrder. |
|
Initialization. This initializes the kernel with the given constant. The norm becomes v*size(). Instead of a single value an initializer list of length size() can be used like this:
vigra::Kernel1D<float> roberts_gradient_x; roberts_gradient_x.initExplicitly(0, 1) = 1.0, -1.0; In this case, the norm will be set to the sum of the init values. An initializer list of wrong length will result in a run-time error. |
|
Copy assignment. |
|
Access kernel value at specified location. Preconditions: |
|
right border of kernel (inclusive), always >= 0 |
|
Set border treatment mode. |
|
© Ullrich Köthe (koethe@informatik.uni-hamburg.de) |
html generated using doxygen and Python
|