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

details Geometric Transformations VIGRA

Functions

template<... >
void resizeImageCatmullRomInterpolation (...)
 Resize image using the Catmull/Rom interpolation function.
template<... >
void resizeImageCoscotInterpolation (...)
 Resize image using the Coscot interpolation function.
template<... >
void resizeImageLinearInterpolation (...)
 Resize image using linear interpolation.
template<... >
void resizeImageNoInterpolation (...)
 Resize image by repeating the nearest pixel values.
template<... >
void resizeImageSplineInterpolation (...)
 Resize image using B-spline interpolation.
template<... >
void resizeMultiArraySplineInterpolation (...)
 Resize MultiArray using B-spline interpolation.
linalg::TemporaryMatrix< double > rotationMatrix2DDegrees (double angle, TinyVector< double, 2 > const &center)
 Create homogeneous matrix representing a 2D rotation about the given point.
linalg::TemporaryMatrix< double > rotationMatrix2DDegrees (double angle)
 Create homogeneous matrix representing a 2D rotation about the coordinate origin.
linalg::TemporaryMatrix< double > rotationMatrix2DRadians (double angle, TinyVector< double, 2 > const &center)
 Create homogeneous matrix representing a 2D rotation about the given point.
linalg::TemporaryMatrix< double > rotationMatrix2DRadians (double angle)
 Create homogeneous matrix representing a 2D rotation about the coordinate origin.
linalg::TemporaryMatrix< double > scalingMatrix2D (double sx, double sy)
 Create homogeneous matrix representing a 2D non-uniform scaling about the coordinate origin.
linalg::TemporaryMatrix< double > scalingMatrix2D (double scalingFactor)
 Create homogeneous matrix representing a 2D uniform scaling about the coordinate origin.
linalg::TemporaryMatrix< double > shearMatrix2D (double s01, double s10)
 Create homogeneous matrix representing a 2D shearing.
linalg::TemporaryMatrix< double > translationMatrix2D (TinyVector< double, 2 > const &shift)
 Create homogeneous matrix representing a 2D translation.


Detailed Description

Zoom up and down by repeating pixels, or using various interpolation schemes.

See also: resamplingConvolveImage(), resampleImage(), resizeMultiArraySplineInterpolation()

#include <vigra/stdimagefunctions.hxx>
or
#include <vigra/resizeimage.hxx>


Function Documentation

linalg::TemporaryMatrix<double> vigra::translationMatrix2D ( TinyVector< double, 2 > const &  shift  ) 

Create homogeneous matrix representing a 2D translation.

For use with affineWarpImage().

linalg::TemporaryMatrix<double> vigra::scalingMatrix2D ( double  scalingFactor  ) 

Create homogeneous matrix representing a 2D uniform scaling about the coordinate origin.

For use with affineWarpImage().

linalg::TemporaryMatrix<double> vigra::scalingMatrix2D ( double  sx,
double  sy 
)

Create homogeneous matrix representing a 2D non-uniform scaling about the coordinate origin.

For use with affineWarpImage().

linalg::TemporaryMatrix<double> vigra::shearMatrix2D ( double  s01,
double  s10 
)

Create homogeneous matrix representing a 2D shearing.

For use with affineWarpImage().

linalg::TemporaryMatrix<double> vigra::rotationMatrix2DRadians ( double  angle  ) 

Create homogeneous matrix representing a 2D rotation about the coordinate origin.

For use with affineWarpImage(). Angle must be in radians.

linalg::TemporaryMatrix<double> vigra::rotationMatrix2DDegrees ( double  angle  ) 

Create homogeneous matrix representing a 2D rotation about the coordinate origin.

For use with affineWarpImage(). Angle must be in degrees.

linalg::TemporaryMatrix<double> vigra::rotationMatrix2DRadians ( double  angle,
TinyVector< double, 2 > const &  center 
)

Create homogeneous matrix representing a 2D rotation about the given point.

For use with affineWarpImage(). Angle must be in radians.

linalg::TemporaryMatrix<double> vigra::rotationMatrix2DDegrees ( double  angle,
TinyVector< double, 2 > const &  center 
)

Create homogeneous matrix representing a 2D rotation about the given point.

For use with affineWarpImage(). Angle must be in degrees.

void vigra::resizeMultiArraySplineInterpolation (   ...  ) 

Resize MultiArray using B-spline interpolation.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class Shape, class SrcAccessor,
                  class DestIterator, class DestAccessor,
                  class Kernel = BSpline<3, double> >
        void
        resizeMultiArraySplineInterpolation(
                              SrcIterator si, Shape const & sshape, SrcAccessor src,
                              DestIterator di, Shape const & dshape, DestAccessor dest,
                              Kernel const & spline = BSpline<3, double>());
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcIterator, class Shape, class SrcAccessor,
                  class DestIterator, class DestAccessor,
                  class Kernel = BSpline<3, double> >
        void
        resizeMultiArraySplineInterpolation(
                              triple<SrcIterator, Shape, SrcAccessor> src,
                              triple<DestIterator, Shape, DestAccessor> dest,
                              Kernel const & spline = BSpline<3, double>());
    }

The function implements separable spline interpolation algorithm described in

M. Unser, A. Aldroubi, M. Eden, "B-Spline Signal Processing" IEEE Transactions on Signal Processing, vol. 41, no. 2, pp. 821-833 (part I), pp. 834-848 (part II), 1993.

to obtain optimal interpolation quality and speed. You may pass the funcion a spline of arbitrary order (e.g. BSpline<ORDER, double> or CatmullRomSpline<double>). The default is a third order spline which gives a twice continuously differentiable interpolant. The implementation ensures that image values are interpolated rather than smoothed by first calling a recursive (sharpening) prefilter as described in the above paper. Then the actual interpolation is done using resamplingConvolveLine().

The range of both the input and output images (resp. regions) must be given. The input image must have a size of at least 4x4, the destination of at least 2x2. The scaling factors are then calculated accordingly. If the source image is larger than the destination, it is smoothed (band limited) using a recursive exponential filter. The source value_type (SrcAccessor::value_type) must be a linear algebra, i.e. it must support addition, subtraction, and multiplication (+, -, *), multiplication with a scalar real number and NumericTraits. The function uses accessors.

Usage:

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

    typedef vigra::MultiArray<3, float>::difference_type Shape;
    vigra::MultiArray<3, float> src(Shape(5, 7, 10)),
                                dest(Shape(9, 13, 19)); // double the size

    // use default cubic spline interpolator
    vigra::resizeMultiArraySplineInterpolation(
               srcMultiArrayRange(src),
               destMultiArrayRange(dest));

Required Interface:

The source and destination iterators must be compatible with vigra::MultiIterator. The array value types must be models of LinearSpace.

void vigra::resizeImageNoInterpolation (   ...  ) 

Resize image by repeating the nearest pixel values.

This algorithm is very fast and does not require any arithmetic on the pixel types.

The range of both the input and output images (resp. regions) must be given. Both images must have a size of at least 2x2 pixels. The scaling factors are then calculated accordingly. Destination pixels are directly copied from the appropriate source pixels.

The function uses accessors.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
        void
        resizeImageNoInterpolation(
              SrcImageIterator is, SrcImageIterator iend, SrcAccessor sa,
              DestImageIterator id, DestImageIterator idend, DestAccessor da)
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
        void
        resizeImageNoInterpolation(
              triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
              triple<DestImageIterator, DestImageIterator, DestAccessor> dest)
    }

Usage:

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

    vigra::resizeImageNoInterpolation(
               src.upperLeft(), src.lowerRight(), src.accessor(),
               dest.upperLeft(), dest.lowerRight(), dest.accessor());

Required Interface:

    SrcImageIterator src_upperleft, src_lowerright;
    DestImageIterator dest_upperleft, src_lowerright;

    SrcAccessor src_accessor;
    DestAccessor dest_accessor;

    dest_accessor.set(src_accessor(src_upperleft), dest_upperleft);

Preconditions:

    src_lowerright.x - src_upperleft.x > 1
    src_lowerright.y - src_upperleft.y > 1
    dest_lowerright.x - dest_upperleft.x > 1
    dest_lowerright.y - dest_upperleft.y > 1
Examples:
pyramid.cxx, and resize.cxx.
void vigra::resizeImageLinearInterpolation (   ...  ) 

Resize image using linear interpolation.

The function uses the standard separable bilinear interpolation algorithm to obtain a good compromize between quality and speed.

The range must of both the input and output images (resp. regions) must be given. Both images must have a size of at least 2x2. The scaling factors are then calculated accordingly. If the source image is larger than the destination, it is smoothed (band limited) using a recursive exponential filter. The source value_type (SrcAccessor::value_type) must be a linear space, i.e. it must support addition, multiplication with a scalar real number and NumericTraits. The function uses accessors.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
        void
        resizeImageLinearInterpolation(
              SrcImageIterator is, SrcImageIterator iend, SrcAccessor sa,
              DestImageIterator id, DestImageIterator idend, DestAccessor da)
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor>
        void
        resizeImageLinearInterpolation(
              triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
              triple<DestImageIterator, DestImageIterator, DestAccessor> dest)
    }

Usage:

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

    vigra::resizeImageLinearInterpolation(
               src.upperLeft(), src.lowerRight(), src.accessor(),
               dest.upperLeft(), dest.lowerRight(), dest.accessor());

Required Interface:

    SrcImageIterator src_upperleft, src_lowerright;
    DestImageIterator dest_upperleft, src_lowerright;

    SrcAccessor src_accessor;
    DestAccessor dest_accessor;

    NumericTraits<SrcAccessor::value_type>::RealPromote
                             u = src_accessor(src_upperleft),
                 v = src_accessor(src_upperleft, 1);
    double d;

    u = d * v;
    u = u + v;

    dest_accessor.set(
        NumericTraits<DestAccessor::value_type>::fromRealPromote(u),
    dest_upperleft);

Preconditions:

    src_lowerright.x - src_upperleft.x > 1
    src_lowerright.y - src_upperleft.y > 1
    dest_lowerright.x - dest_upperleft.x > 1
    dest_lowerright.y - dest_upperleft.y > 1
Examples:
resize.cxx.
void vigra::resizeImageSplineInterpolation (   ...  ) 

Resize image using B-spline interpolation.

The function implements separable spline interpolation algorithm described in

M. Unser, A. Aldroubi, M. Eden, "B-Spline Signal Processing" IEEE Transactions on Signal Processing, vol. 41, no. 2, pp. 821-833 (part I), pp. 834-848 (part II), 1993.

to obtain optimal interpolation quality and speed. You may pass the funcion a spline of arbitrary order (e.g. BSpline<ORDER, double> or CatmullRomSpline<double>). The default is a third order spline which gives a twice continuously differentiable interpolant. The implementation ensures that image values are interpolated rather than smoothed by first calling a recursive (sharpening) prefilter as described in the above paper. Then the actual interpolation is done using resamplingConvolveLine().

The range of both the input and output images (resp. regions) must be given. The input image must have a size of at least 4x4, the destination of at least 2x2. The scaling factors are then calculated accordingly. If the source image is larger than the destination, it is smoothed (band limited) using a recursive exponential filter. The source value_type (SrcAccessor::value_type) must be a linear algebra, i.e. it must support addition, subtraction, and multiplication (+, -, *), multiplication with a scalar real number and NumericTraits. The function uses accessors.

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor,
                  class SPLINE>
        void
        resizeImageSplineInterpolation(
              SrcImageIterator is, SrcImageIterator iend, SrcAccessor sa,
              DestImageIterator id, DestImageIterator idend, DestAccessor da,
              SPLINE spline = BSpline<3, double>())
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcImageIterator, class SrcAccessor,
                  class DestImageIterator, class DestAccessor,
                  class SPLINE>
        void
        resizeImageSplineInterpolation(
              triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
              triple<DestImageIterator, DestImageIterator, DestAccessor> dest,
              SPLINE spline = BSpline<3, double>())
    }

Usage:

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

    vigra::resizeImageSplineInterpolation(
               src.upperLeft(), src.lowerRight(), src.accessor(),
               dest.upperLeft(), dest.lowerRight(), dest.accessor());

Required Interface:

    SrcImageIterator src_upperleft, src_lowerright;
    DestImageIterator dest_upperleft, src_lowerright;

    SrcAccessor src_accessor;
    DestAccessor dest_accessor;

    NumericTraits<SrcAccessor::value_type>::RealPromote
                             u = src_accessor(src_upperleft),
                 v = src_accessor(src_upperleft, 1);
    double d;

    u = d * v;
    u = u + v;
    u = u - v;
    u = u * v;
    u += v;
    u -= v;

    dest_accessor.set(
        NumericTraits<DestAccessor::value_type>::fromRealPromote(u),
    dest_upperleft);

Preconditions:

    src_lowerright.x - src_upperleft.x > 3
    src_lowerright.y - src_upperleft.y > 3
    dest_lowerright.x - dest_upperleft.x > 1
    dest_lowerright.y - dest_upperleft.y > 1
Examples:
resize.cxx.
void vigra::resizeImageCatmullRomInterpolation (   ...  ) 

Resize image using the Catmull/Rom interpolation function.

The function calls like resizeImageSplineInterpolation() with vigra::CatmullRomSpline as an interpolation kernel. The interpolated function has one continuous derivative. (See resizeImageSplineInterpolation() for more documentation)

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        resizeImageCatmullRomInterpolation(SrcIterator src_iter, SrcIterator src_iter_end, SrcAccessor src_acc,
                              DestIterator dest_iter, DestIterator dest_iter_end, DestAccessor dest_acc);
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        resizeImageCatmullRomInterpolation(triple<SrcIterator, SrcIterator, SrcAccessor> src,
                              triple<DestIterator, DestIterator, DestAccessor> dest);
    }

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

void vigra::resizeImageCoscotInterpolation (   ...  ) 

Resize image using the Coscot interpolation function.

The function calls resizeImageSplineInterpolation() with vigra::CoscotFunction as an interpolation kernel. The interpolated function has one continuous derivative. (See resizeImageSplineInterpolation() for more documentation)

Declarations:

pass arguments explicitly:

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        resizeImageCoscotInterpolation(SrcIterator src_iter, SrcIterator src_iter_end, SrcAccessor src_acc,
                              DestIterator dest_iter, DestIterator dest_iter_end, DestAccessor dest_acc);
    }

use argument objects in conjunction with Argument Object Factories :

    namespace vigra {
        template <class SrcIterator, class SrcAccessor,
                  class DestIterator, class DestAccessor>
        void
        resizeImageCoscotInterpolation(triple<SrcIterator, SrcIterator, SrcAccessor> src,
                              triple<DestIterator, DestIterator, DestAccessor> dest);
    }

#include <vigra/resizeimage.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.6.0 (5 Nov 2009)