[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]

| Recursive convolution functions |
--- | --- | ---

## Functions

template<...> void | recursiveFilterLine (SrcIterator is, SrcIterator isend, SrcAccessor as, DestIterator id, DestAccessor ad, double b, BorderTreatmentMode border)
| Performs a 1-dimensional recursive convolution of the source signal.
template<...> void | recursiveSmoothLine (SrcIterator is, SrcIterator isend, SrcAccessor as, DestIterator id, DestAccessor ad, double scale)
| Convolves the image with a 1-dimensional exponential filter.
template<...> void | recursiveFirstDerivativeLine (SrcIterator is, SrcIterator isend, SrcAccessor as, DestIterator id, DestAccessor ad, double scale)
| Performs a 1 dimensional recursive convolution of the source signal.
template<...> void | recursiveSecondDerivativeLine (SrcIterator is, SrcIterator isend, SrcAccessor as, DestIterator id, DestAccessor ad, double scale)
| Performs a 1 dimensional recursive convolution of the source signal.
template<...> void | recursiveFilterX (SrcImageIterator supperleft, SrcImageIterator slowerright, SrcAccessor as, DestImageIterator dupperleft, DestAccessor ad, double b, BorderTreatmentMode border)
| Performs 1 dimensional recursive filtering (1st and 2nd order) in x direction.
template<...> void | recursiveSmoothX (SrcImageIterator supperleft, SrcImageIterator slowerright, SrcAccessor as, DestImageIterator dupperleft, DestAccessor ad, double scale)
| Performs 1 dimensional recursive smoothing in x direction.
template<...> void | recursiveFilterY (SrcImageIterator supperleft, SrcImageIterator slowerright, SrcAccessor as, DestImageIterator dupperleft, DestAccessor ad, double b, BorderTreatmentMode border)
| Performs 1 dimensional recursive filtering (1st and 2nd order) in y direction.
template<...> void | recursiveSmoothY (SrcImageIterator supperleft, SrcImageIterator slowerright, SrcAccessor as, DestImageIterator dupperleft, DestAccessor ad, double scale)
| Performs 1 dimensional recursive smoothing in y direction.
template<...> void | recursiveFirstDerivativeX (SrcImageIterator supperleft, SrcImageIterator slowerright, SrcAccessor as, DestImageIterator dupperleft, DestAccessor ad, double scale)
| Recursively calculates the 1 dimensional first derivative in x direction.
template<...> void | recursiveFirstDerivativeY (SrcImageIterator supperleft, SrcImageIterator slowerright, SrcAccessor as, DestImageIterator dupperleft, DestAccessor ad, double scale)
| Recursively calculates the 1 dimensional first derivative in y direction.
template<...> void | recursiveSecondDerivativeX (SrcImageIterator supperleft, SrcImageIterator slowerright, SrcAccessor as, DestImageIterator dupperleft, DestAccessor ad, double scale)
| Recursively calculates the 1 dimensional second derivative in x direction.
template<...> void | recursiveSecondDerivativeY (SrcImageIterator supperleft, SrcImageIterator slowerright, SrcAccessor as, DestImageIterator dupperleft, DestAccessor ad, double scale)
| Recursively calculates the 1 dimensional second derivative in y direction.

## Detailed Description

First order recursive filters and their specialization for the exponential filter and its derivatives (1D and separable 2D). These filters are very fast, and the speed does not depend on the filter size.

## Function Documentation

void recursiveFilterLine (...)

Performs a 1-dimensional recursive convolution of the source signal.

The function performs a causal and an anti-causal first or second order recursive filtering with the given filter parameter `b1` and border treatment `border` (first order filter, `b2 = 0`) or parameters `b1, b2` and `BORDER_TREATMENT_REFLECT` (second order filter). Thus, the result is always a filtering with linear phase.

The signal's value_type (SrcAccessor::value_type) must be a linear space over `double`, i.e. addition of source values, multiplication with `double`, and `NumericTraits` must be defined.

Declaration:

First order recursive filter:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor>
            void recursiveFilterLine(SrcIterator is, SrcIterator isend, SrcAccessor as,
                         DestIterator id, DestAccessor ad,
                         double b1, BorderTreatmentMode border)
        }

Second order recursive filter:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor>
            void recursiveFilterLine(SrcIterator is, SrcIterator isend, SrcAccessor as,
                         DestIterator id, DestAccessor ad,
                         double b1, double b2)
        }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vector<float> src, dest;
        ...

        vigra::DefaultAccessor<vector<float>::iterator, float> FAccessor;

        vigra::recursiveFilterLine(src.begin(), src.end(), FAccessor(),
                                   dest.begin(), FAccessor(),
                                   0.5, BORDER_TREATMENT_REFLECT);

Required Interface:

        RandomAccessIterator is, isend;
        RandomAccessIterator id;

        SrcAccessor src_accessor;
        DestAccessor dest_accessor;

        NumericTraits<SrcAccessor::value_type>::RealPromote s = src_accessor(is);
        double d;

        s = s + s;
        s = d * s;

        dest_accessor.set(
            NumericTraits<DestAccessor::value_type>::fromRealPromote(s), id);

Preconditions:

        -1 < b < 1

void recursiveFilterX (...)

Performs 1 dimensional recursive filtering (1st and 2nd order) in x direction.

It calls recursiveFilterLine() for every row of the image. See recursiveFilterLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass arguments explicitly:

        namespace vigra {
            // first order filter
            template <class SrcImageIterator, class SrcAccessor,
                      class DestImageIterator, class DestAccessor>
            void recursiveFilterX(SrcImageIterator supperleft,
                                   SrcImageIterator slowerright, SrcAccessor as,
                                   DestImageIterator dupperleft, DestAccessor ad,
                                   double b, BorderTreatmentMode border);

            // second order filter
            template <class SrcImageIterator, class SrcAccessor,
                      class DestImageIterator, class DestAccessor>
            void recursiveFilterX(SrcImageIterator supperleft,
                                   SrcImageIterator slowerright, SrcAccessor as,
                                   DestImageIterator dupperleft, DestAccessor ad,
                                   double b1, double b2);
        }

use argument objects in conjunction with Argument Object Factories:

        namespace vigra {
            // first order filter
            template <class SrcImageIterator, class SrcAccessor,
                      class DestImageIterator, class DestAccessor>
            void recursiveFilterX(
                        triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                        pair<DestImageIterator, DestAccessor> dest,
                        double b, BorderTreatmentMode border);

            // second order filter
            template <class SrcImageIterator, class SrcAccessor,
                      class DestImageIterator, class DestAccessor>
            void recursiveFilterX(
                        triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                        pair<DestImageIterator, DestAccessor> dest,
                        double b1, double b2);
                }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vigra::FImage src(w,h), dest(w,h);
        ...

        vigra::recursiveSmoothX(srcImageRange(src), destImage(dest),
               0.5, BORDER_TREATMENT_REFLECT);

void recursiveFilterY (...)

Performs 1 dimensional recursive filtering (1st and 2nd order) in y direction.

It calls recursiveFilterLine() for every column of the image. See recursiveFilterLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass arguments explicitly:

        namespace vigra {
            // first order filter
            template <class SrcImageIterator, class SrcAccessor,
                      class DestImageIterator, class DestAccessor>
            void recursiveFilterY(SrcImageIterator supperleft,
                                   SrcImageIterator slowerright, SrcAccessor as,
                                   DestImageIterator dupperleft, DestAccessor ad,
                                   double b, BorderTreatmentMode border);

            // second order filter
            template <class SrcImageIterator, class SrcAccessor,
                      class DestImageIterator, class DestAccessor>
            void recursiveFilterY(SrcImageIterator supperleft,
                                   SrcImageIterator slowerright, SrcAccessor as,
                                   DestImageIterator dupperleft, DestAccessor ad,
                                   double b1, double b2);
        }

use argument objects in conjunction with Argument Object Factories:

        namespace vigra {
            // first order filter
            template <class SrcImageIterator, class SrcAccessor,
                      class DestImageIterator, class DestAccessor>
            void recursiveFilterY(
                        triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                        pair<DestImageIterator, DestAccessor> dest,
                        double b, BorderTreatmentMode border);

            // second order filter
            template <class SrcImageIterator, class SrcAccessor,
                      class DestImageIterator, class DestAccessor>
            void recursiveFilterY(
                        triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                        pair<DestImageIterator, DestAccessor> dest,
                        double b1, double b2);
                }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vigra::FImage src(w,h), dest(w,h);
        ...

        vigra::recursiveFilterY(srcImageRange(src), destImage(dest), -0.6, -0.06);

void recursiveFirstDerivativeLine (...)

Performs a 1 dimensional recursive convolution of the source signal.

It uses the first derivative an exponential `d/dx exp(-abs(x)/scale)` as a kernel. The signal's value_type (SrcAccessor::value_type) must be a linear space over `double`, i.e. addition and subtraction of source values, multiplication with `double`, and `NumericTraits` must be defined. Border treatment is always `BORDER_TREATMENT_REPEAT`.

Declaration:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor>
            void recursiveFirstDerivativeLine(SrcIterator is, SrcIterator isend, SrcAccessor as,
                         DestIterator id, DestAccessor ad, double scale)
        }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vector<float> src, dest;
        ...

        vigra::DefaultAccessor<vector<float>::iterator, float> FAccessor;

        vigra::recursiveFirstDerivativeLine(src.begin(), src.end(), FAccessor(),
                            dest.begin(), FAccessor(), 3.0);

Required Interface:

        RandomAccessIterator is, isend;
        RandomAccessIterator id;

        SrcAccessor src_accessor;
        DestAccessor dest_accessor;

        NumericTraits<SrcAccessor::value_type>::RealPromote s = src_accessor(is);
        double d;

        s = s + s;
        s = -s;
        s = d * s;

        dest_accessor.set(
            NumericTraits<DestAccessor::value_type>::fromRealPromote(s), id);

Preconditions:

        scale > 0

void recursiveFirstDerivativeX (...)

Recursively calculates the 1 dimensional first derivative in x direction.

It calls recursiveFirstDerivativeLine() for every row of the image. See recursiveFirstDerivativeLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveFirstDerivativeX(SrcImageIterator supperleft,
                      SrcImageIterator slowerright, SrcAccessor as,
                      DestImageIterator dupperleft, DestAccessor ad,
                      double scale)
        }

use argument objects in conjunction with Argument Object Factories:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveFirstDerivativeX(
                triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                pair<DestImageIterator, DestAccessor> dest,
                double scale)
        }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vigra::FImage src(w,h), dest(w,h);
        ...

        vigra::recursiveFirstDerivativeX(srcImageRange(src), destImage(dest), 3.0);

void recursiveFirstDerivativeY (...)

Recursively calculates the 1 dimensional first derivative in y direction.

It calls recursiveFirstDerivativeLine() for every column of the image. See recursiveFirstDerivativeLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveFirstDerivativeY(SrcImageIterator supperleft,
                      SrcImageIterator slowerright, SrcAccessor as,
                      DestImageIterator dupperleft, DestAccessor ad,
                      double scale)
        }

use argument objects in conjunction with Argument Object Factories:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveFirstDerivativeY(
                triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                pair<DestImageIterator, DestAccessor> dest,
                double scale)
        }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vigra::FImage src(w,h), dest(w,h);
        ...

        vigra::recursiveFirstDerivativeY(srcImageRange(src), destImage(dest), 3.0);

void recursiveSecondDerivativeLine (...)

Performs a 1 dimensional recursive convolution of the source signal.

It uses the second derivative an exponential `d2/dx2 exp(-abs(x)/scale)` as a kernel. The signal's value_type (SrcAccessor::value_type) must be a linear space over `double`, i.e. addition and subtraction of source values, multiplication with `double`, and `NumericTraits` must be defined. Border treatment is always `BORDER_TREATMENT_REPEAT`.

Declaration:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor>
            void recursiveSecondDerivativeLine(SrcIterator is, SrcIterator isend, SrcAccessor as,
                         DestIterator id, DestAccessor ad, double scale)
        }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vector<float> src, dest;
        ...

        vigra::DefaultAccessor<vector<float>::iterator, float> FAccessor;

        vigra::recursiveSecondDerivativeLine(src.begin(), src.end(), FAccessor(),
                            dest.begin(), FAccessor(), 3.0);

Required Interface:

        RandomAccessIterator is, isend;
        RandomAccessIterator id;

        SrcAccessor src_accessor;
        DestAccessor dest_accessor;

        NumericTraits<SrcAccessor::value_type>::RealPromote s = src_accessor(is);
        double d;

        s = s + s;
        s = s - s;
        s = d * s;

        dest_accessor.set(
            NumericTraits<DestAccessor::value_type>::fromRealPromote(s), id);

Preconditions:

        scale > 0

void recursiveSecondDerivativeX (...)

Recursively calculates the 1 dimensional second derivative in x direction.

It calls recursiveSecondDerivativeLine() for every row of the image. See recursiveSecondDerivativeLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveSecondDerivativeX(SrcImageIterator supperleft,
                      SrcImageIterator slowerright, SrcAccessor as,
                      DestImageIterator dupperleft, DestAccessor ad,
                      double scale)
        }

use argument objects in conjunction with Argument Object Factories:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveSecondDerivativeX(
                triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                pair<DestImageIterator, DestAccessor> dest,
                double scale)
        }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vigra::FImage src(w,h), dest(w,h);
        ...

        vigra::recursiveSecondDerivativeX(srcImageRange(src), destImage(dest), 3.0);

void recursiveSecondDerivativeY (...)

Recursively calculates the 1 dimensional second derivative in y direction.

It calls recursiveSecondDerivativeLine() for every column of the image. See recursiveSecondDerivativeLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveSecondDerivativeY(SrcImageIterator supperleft,
                      SrcImageIterator slowerright, SrcAccessor as,
                      DestImageIterator dupperleft, DestAccessor ad,
                      double scale)
        }

use argument objects in conjunction with Argument Object Factories:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveSecondDerivativeY(
                triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                pair<DestImageIterator, DestAccessor> dest,
                double scale)
        }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vigra::FImage src(w,h), dest(w,h);
        ...

        vigra::recursiveSecondDerivativeY(srcImageRange(src), destImage(dest), 3.0);

void recursiveSmoothLine (...)

Convolves the image with a 1-dimensional exponential filter.

This function calls recursiveFilterLine() with `b = exp(-1.0/scale)` and `border = BORDER_TREATMENT_REPEAT`. See recursiveFilterLine() for more documentation.

Declaration:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor>
            void recursiveSmoothLine(SrcIterator is, SrcIterator isend, SrcAccessor as,
                         DestIterator id, DestAccessor ad, double scale)
        }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vector<float> src, dest;
        ...

        vigra::DefaultAccessor<vector<float>::iterator, float> FAccessor;

        vigra::recursiveSmoothLine(src.begin(), src.end(), FAccessor(),
                            dest.begin(), FAccessor(), 3.0);

Required Interface:

        RandomAccessIterator is, isend;
        RandomAccessIterator id;

        SrcAccessor src_accessor;
        DestAccessor dest_accessor;

        NumericTraits<SrcAccessor::value_type>::RealPromote s = src_accessor(is);
        double d;

        s = s + s;
        s = d * s;

        dest_accessor.set(
            NumericTraits<DestAccessor::value_type>::fromRealPromote(s), id);

Preconditions:

        scale > 0

void recursiveSmoothX (...)

Performs 1 dimensional recursive smoothing in x direction.

It calls recursiveSmoothLine() for every row of the image. See recursiveSmoothLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveSmoothX(SrcImageIterator supperleft,
                      SrcImageIterator slowerright, SrcAccessor as,
                      DestImageIterator dupperleft, DestAccessor ad,
                      double scale)
        }

use argument objects in conjunction with Argument Object Factories:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveSmoothX(
                triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                pair<DestImageIterator, DestAccessor> dest,
                double scale)
        }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vigra::FImage src(w,h), dest(w,h);
        ...

        vigra::recursiveSmoothX(srcImageRange(src), destImage(dest), 3.0);

void recursiveSmoothY (...)

Performs 1 dimensional recursive smoothing in y direction.

It calls recursiveSmoothLine() for every column of the image. See recursiveSmoothLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveSmoothY(SrcImageIterator supperleft,
                      SrcImageIterator slowerright, SrcAccessor as,
                      DestImageIterator dupperleft, DestAccessor ad,
                      double scale)
        }

use argument objects in conjunction with Argument Object Factories:

        namespace vigra {
            template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
            void recursiveSmoothY(
                triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
                pair<DestImageIterator, DestAccessor> dest,
                double scale)
        }

Usage:

#include "vigra/recursiveconvolution.hxx"
Namespace: vigra

        vigra::FImage src(w,h), dest(w,h);
        ...

        vigra::recursiveSmoothY(srcImageRange(src), destImage(dest), 3.0);

© Ullrich Köthe (koethe@informatik.uni-hamburg.de) Cognitive Systems Group, University of Hamburg, Germany | html generated using doxygen and Python VIGRA 1.4.0 (21 Dec 2005)