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

| Resampling Convolution Filters |

## Functions

template<... >
void | pyramidExpandBurtFilter (...)
| Two-fold up-sampling for image pyramid reconstruction.
template<class Image , class Alloc >
void | pyramidExpandBurtLaplacian (ImagePyramid< Image, Alloc > &pyramid, int fromLevel, int toLevel, double centerValue=0.4)
| Reconstruct a Laplacian pyramid.
template<... >
void | pyramidReduceBurtFilter (...)
| Two-fold down-sampling for image pyramid construction.
template<class Image , class Alloc >
void | pyramidReduceBurtLaplacian (ImagePyramid< Image, Alloc > &pyramid, int fromLevel, int toLevel, double centerValue=0.4)
| Create a Laplacian pyramid.
template<... >
void | resamplingConvolveImage (...)
| Apply two separable resampling filters successively, the first in x-direction, the second in y-direction.
template<... >
void | resamplingConvolveLine (...)
| Performs a 1-dimensional resampling convolution of the source signal using the given set of kernels.
template<... >
void | resamplingConvolveX (...)
| Apply a resampling filter in the x-direction.
template<... >
void | resamplingConvolveY (...)
| Apply a resampling filter in the y-direction.

## Detailed Description

These functions implement the convolution operation when the source and target images have different sizes. This is realized by accessing a continuous kernel at the appropriate non-integer positions. The technique is, for example, described in D. Schumacher: General Filtered Image Rescaling, in: Graphics Gems III, Academic Press, 1992.

## Function Documentation

void vigra::resamplingConvolveLine | ( |  | ... | ) |

Performs a 1-dimensional resampling convolution of the source signal using the given set of kernels.

This function is mainly used internally: It is called for each dimension of a higher dimensional array in order to perform a separable resize operation.

Declaration:

#include <vigra/resampling_convolution.hxx>

        namespace vigra {
            template <class SrcIter, class SrcAcc,
                      class DestIter, class DestAcc,
                      class KernelArray,
                      class Functor>
            void
            resamplingConvolveLine(SrcIter s, SrcIter send, SrcAcc src,
                                   DestIter d, DestIter dend, DestAcc dest,
                                   KernelArray const & kernels,
                                   Functor mapTargetToSourceCoordinate)
        }

void vigra::resamplingConvolveX | ( |  | ... | ) |

Apply a resampling filter in the x-direction.

This function implements a convolution operation in x-direction (i.e. applies a 1D filter to every row) where the width of the source and destination images differ. This is typically used to avoid aliasing if the image is scaled down, or to interpolate smoothly if the image is scaled up. The target coordinates are transformed into source coordinates by

        xsource = (xtarget - offset) / samplingRatio

The `samplingRatio` and `offset` must be given as vigra::Rational in order to avoid rounding errors in this transformation. It is required that for all pixels of the target image, `xsource` remains within the range of the source image (i.e. `0 <= xsource <= sourceWidth-1`. Since `xsource` is in general not an integer, the `kernel` must be a functor that can be accessed at arbitrary (`double`) coordinates. It must also provide a member function `radius()` which specifies the support (non-zero interval) of the kernel. VIGRA already provides a number of suitable functors, e.g. vigra::Gaussian, vigra::BSpline vigra::CatmullRomSpline, and vigra::CoscotFunction. The function resizeImageSplineInterpolation() is implemented by means resamplingConvolveX() and resamplingConvolveY().

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcIter, class SrcAcc,
                      class DestIter, class DestAcc,
                      class Kernel>
            void
            resamplingConvolveX(SrcIter sul, SrcIter slr, SrcAcc src,
                                DestIter dul, DestIter dlr, DestAcc dest,
                                Kernel const & kernel,
                                Rational<int> const & samplingRatio, Rational<int> const & offset);
        }

use argument objects in conjunction with Argument Object Factories :

        namespace vigra {
            template <class SrcIter, class SrcAcc,
                      class DestIter, class DestAcc,
                      class Kernel>
            void
            resamplingConvolveX(triple<SrcIter, SrcIter, SrcAcc> src,
                                triple<DestIter, DestIter, DestAcc> dest,
                                Kernel const & kernel,
                                Rational<int> const & samplingRatio, Rational<int> const & offset);
        }

Usage:

#include <vigra/resampling_convolution.hxx>

        Rational<int> ratio(2), offset(0);

        FImage src(w,h),
               dest(rational_cast<int>(ratio*w), h);

        float sigma = 2.0;
        Gaussian<float> smooth(sigma);
        ...

        // simultaneously enlarge and smooth source image
        resamplingConvolveX(srcImageRange(src), destImageRange(dest),
                            smooth, ratio, offset);

Required Interface:

        Kernel kernel;
        int kernelRadius = kernel.radius();
        double x = ...;  // must be <= radius()
        double value = kernel(x);

void vigra::resamplingConvolveY | ( |  | ... | ) |

Apply a resampling filter in the y-direction.

This function implements a convolution operation in y-direction (i.e. applies a 1D filter to every column) where the height of the source and destination images differ. This is typically used to avoid aliasing if the image is scaled down, or to interpolate smoothly if the image is scaled up. The target coordinates are transformed into source coordinates by

        ysource = (ytarget - offset) / samplingRatio

The `samplingRatio` and `offset` must be given as vigra::Rational in order to avoid rounding errors in this transformation. It is required that for all pixels of the target image, `ysource` remains within the range of the source image (i.e. `0 <= ysource <= sourceHeight-1`. Since `ysource` is in general not an integer, the `kernel` must be a functor that can be accessed at arbitrary (`double`) coordinates. It must also provide a member function `radius()` which specifies the support (non-zero interval) of the kernel. VIGRA already provides a number of suitable functors, e.g. vigra::Gaussian, vigra::BSpline vigra::CatmullRomSpline, and vigra::CoscotFunction. The function resizeImageSplineInterpolation() is implemented by means resamplingConvolveX() and resamplingConvolveY().

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcIter, class SrcAcc,
                      class DestIter, class DestAcc,
                      class Kernel>
            void
            resamplingConvolveY(SrcIter sul, SrcIter slr, SrcAcc src,
                                DestIter dul, DestIter dlr, DestAcc dest,
                                Kernel const & kernel,
                                Rational<int> const & samplingRatio, Rational<int> const & offset);
        }

use argument objects in conjunction with Argument Object Factories :

        namespace vigra {
            template <class SrcIter, class SrcAcc,
                      class DestIter, class DestAcc,
                      class Kernel>
            void
            resamplingConvolveY(triple<SrcIter, SrcIter, SrcAcc> src,
                                triple<DestIter, DestIter, DestAcc> dest,
                                Kernel const & kernel,
                                Rational<int> const & samplingRatio, Rational<int> const & offset);
        }

Usage:

#include <vigra/resampling_convolution.hxx>

        Rational<int> ratio(2), offset(0);

        FImage src(w,h),
               dest(w, rational_cast<int>(ratio*h));

        float sigma = 2.0;
        Gaussian<float> smooth(sigma);
        ...

        // simultaneously enlarge and smooth source image
        resamplingConvolveY(srcImageRange(src), destImageRange(dest),
                            smooth, ratio, offset);

Required Interface:

        Kernel kernel;
        int kernelRadius = kernel.radius();
        double y = ...;  // must be <= radius()
        double value = kernel(y);

void vigra::resamplingConvolveImage | ( |  | ... | ) |

Apply two separable resampling filters successively, the first in x-direction, the second in y-direction.

This function is a shorthand for the concatenation of a call to resamplingConvolveX() and resamplingConvolveY() with the given kernels. See there for detailed documentation.

Declarations:

pass arguments explicitly:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor,
                      class KernelX, class KernelY>
            void resamplingConvolveImage(SrcIterator sul,SrcIterator slr, SrcAccessor src,
                               DestIterator dul, DestIterator dlr, DestAccessor dest,
                               KernelX const & kx,
                               Rational<int> const & samplingRatioX, Rational<int> const & offsetX,
                               KernelY const & ky,
                               Rational<int> const & samplingRatioY, Rational<int> const & offsetY);
        }

use argument objects in conjunction with Argument Object Factories :

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor,
                      class KernelX, class KernelY>
            void
            resamplingConvolveImage(triple<SrcIterator, SrcIterator, SrcAccessor> src,
                               triple<DestIterator, DestIterator, DestAccessor> dest,
                               KernelX const & kx,
                               Rational<int> const & samplingRatioX, Rational<int> const & offsetX,
                               KernelY const & ky,
                               Rational<int> const & samplingRatioY, Rational<int> const & offsetY);
        }

Usage:

#include <vigra/resampling_convolution.hxx>

        Rational<int> xratio(2), yratio(3), offset(0);

        FImage src(w,h),
               dest(rational_cast<int>(xratio*w), rational_cast<int>(yratio*h));

        float sigma = 2.0;
        Gaussian<float> smooth(sigma);
        ...

        // simultaneously enlarge and smooth source image
        resamplingConvolveImage(srcImageRange(src), destImageRange(dest),
                                smooth, xratio, offset,
                                smooth, yratio, offset);

void vigra::pyramidReduceBurtFilter | ( |  | ... | ) |

Two-fold down-sampling for image pyramid construction.

Sorry, no detailedDocumentation() available yet.

Declarations:

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

pass arguments explicitly:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor>
            void pyramidReduceBurtFilter(SrcIterator sul, SrcIterator slr, SrcAccessor src,
                                         DestIterator dul, DestIterator dlr, DestAccessor dest,
                                         double centerValue = 0.4);
        }

use argument objects in conjunction with Argument Object Factories :

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor>
            void pyramidReduceBurtFilter(triple<SrcIterator, SrcIterator, SrcAccessor> src,
                                         triple<DestIterator, DestIterator, DestAccessor> dest,
                                         double centerValue = 0.4);
        }

use a vigra::ImagePyramid :

        namespace vigra {
            template <class Image, class Alloc>
            void pyramidReduceBurtFilter(ImagePyramid<Image, Alloc> & pyramid, int fromLevel, int toLevel,
                                         double centerValue = 0.4);
        }

void vigra::pyramidExpandBurtFilter | ( |  | ... | ) |

Two-fold up-sampling for image pyramid reconstruction.

Sorry, no detailedDocumentation() available yet.

Declarations:

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

pass arguments explicitly:

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor>
            void pyramidExpandBurtFilter(SrcIterator sul, SrcIterator slr, SrcAccessor src,
                                         DestIterator dul, DestIterator dlr, DestAccessor dest,
                                         double centerValue = 0.4);
        }

use argument objects in conjunction with Argument Object Factories :

        namespace vigra {
            template <class SrcIterator, class SrcAccessor,
                      class DestIterator, class DestAccessor>
            void pyramidExpandBurtFilter(triple<SrcIterator, SrcIterator, SrcAccessor> src,
                                         triple<DestIterator, DestIterator, DestAccessor> dest,
                                         double centerValue = 0.4);
        }

use a vigra::ImagePyramid :

        namespace vigra {
            template <class Image, class Alloc>
            void pyramidExpandBurtFilter(ImagePyramid<Image, Alloc> & pyramid, int fromLevel, int toLevel,
                                         double centerValue = 0.4);
        }

void vigra::pyramidReduceBurtLaplacian | ( | ImagePyramid< Image, Alloc > & | pyramid,
|  | int | fromLevel,
|  | int | toLevel,
|  | double | centerValue = `0.4`
| ) |  |

Create a Laplacian pyramid.

Sorry, no detailedDocumentation() available yet.

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

void vigra::pyramidExpandBurtLaplacian | ( | ImagePyramid< Image, Alloc > & | pyramid,
|  | int | fromLevel,
|  | int | toLevel,
|  | double | centerValue = `0.4`
| ) |  |

Reconstruct a Laplacian pyramid.

Sorry, no detailedDocumentation() available yet.

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.9.0 (Tue Nov 6 2012)