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

| Geometric Transformations |

## Functions
template<... >
void | affineWarpImage (...)
| Warp an image according to an affine transformation. More...
template<... >
void | reflectImage (...)
| Reflect image horizontally or vertically. More...
template<... >
void | resampleImage (...)
| Resample image by a given factor. More...
template<... >
void | resizeImageCatmullRomInterpolation (...)
| Resize image using the Catmull/Rom interpolation function. More...
template<... >
void | resizeImageCoscotInterpolation (...)
| Resize image using the Coscot interpolation function. More...
template<... >
void | resizeImageLinearInterpolation (...)
| Resize image using linear interpolation. More...
template<... >
void | resizeImageNoInterpolation (...)
| Resize image by repeating the nearest pixel values. More...
template<... >
void | resizeImageSplineInterpolation (...)
| Resize image using B-spline interpolation. More...
template<... >
void | resizeMultiArraySplineInterpolation (...)
| Resize MultiArray using B-spline interpolation. More...
template<... >
void | rotateImage (...)
| Rotate an image by a multiple of 90 degrees or by an arbitrary angle. More...
linalg::TemporaryMatrix< double > | rotationMatrix2DDegrees (double angle)
| Create homogeneous matrix representing a 2D rotation about the coordinate origin. More...
linalg::TemporaryMatrix< double > | rotationMatrix2DDegrees (double angle, TinyVector< double, 2 > const &center)
| Create homogeneous matrix representing a 2D rotation about the given point. More...
linalg::TemporaryMatrix< double > | rotationMatrix2DRadians (double angle)
| Create homogeneous matrix representing a 2D rotation about the coordinate origin. More...
linalg::TemporaryMatrix< double > | rotationMatrix2DRadians (double angle, TinyVector< double, 2 > const &center)
| Create homogeneous matrix representing a 2D rotation about the given point. More...
linalg::TemporaryMatrix< double > | scalingMatrix2D (double scalingFactor)
| Create homogeneous matrix representing a 2D uniform scaling about the coordinate origin. More...
linalg::TemporaryMatrix< double > | scalingMatrix2D (double sx, double sy)
| Create homogeneous matrix representing a 2D non-uniform scaling about the coordinate origin. More...
linalg::TemporaryMatrix< double > | shearMatrix2D (double s01, double s10)
| Create homogeneous matrix representing a 2D shearing. More...
linalg::TemporaryMatrix< double > | translationMatrix2D (TinyVector< double, 2 > const &shift)
| Create homogeneous matrix representing a 2D translation. More...
template<... >
void | transposeImage (...)
| Transpose an image over the major or minor diagonal. More...

## Detailed Description

Resize or warp an array using various interpolation schemes or just pixel repetition.

See also: Image Registration, vigra::SplineImageView

## 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::affineWarpImage | ( |  | ... | ) |

Warp an image according to an affine transformation.

Declarations:

pass 2D array views:

namespace vigra {
template <int ORDER, class T,
class T2, class S2,
class C>
void
affineWarpImage(SplineImageView<ORDER, T> const & src,
MultiArrayView<2, T2, S2> dest,
MultiArrayView<2, double, C> const & affineMatrix);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <int ORDER, class T,
class DestIterator, class DestAccessor,
class C>
void affineWarpImage(SplineImageView<ORDER, T> const & src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
MultiArrayView<2, double, C> const & affineMatrix);
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <int ORDER, class T,
class DestIterator, class DestAccessor,
class C>
void affineWarpImage(SplineImageView<ORDER, T> const & src,
triple<DestIterator, DestIterator, DestAccessor> dest,
MultiArrayView<2, double, C> const & affineMatrix);
}

The algorithm applies the given affineMatrix to the destination coordinates and copies the image value from the resulting source coordinates, using the given SplineImageView src for interpolation. If the resulting coordinate is outside the source image, nothing will be written at that destination point.

for all dest pixels:
currentSrcCoordinate = affineMatrix * currentDestCoordinate;
if src.isInside(currentSrcCoordinate):
dest[currentDestCoordinate] = src[currentSrcCoordinate]; // copy an interpolated value

The matrix represents a 2-dimensional affine transform by means of homogeneous coordinates, i.e. it must be a 3x3 matrix whose last row is (0,0,1).

Usage:

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

MultiArray<2, float> src(width, height);
SplineImageView<3, float> spline(src);
MultiArray<2, float> dest1(src.shape());
// equivalent (up to round-off errors) to
// rotateImage(spline, dest1, 45.0);
TinyVector<double, 2> center((width-1.0)/2.0, (height-1.0)/2.0);
affineWarpImage(spline, dest1, rotationMatrix2DDegrees(45.0, center));
MultiArray<2, float> dest2(2*width-1, 2*height-1);
// equivalent (up to round-off errors) to
// resizeImageSplineInterpolation(img, dest2);
// note that scaleFactor = 0.5, because we must pass the transformation from destination to source
affineWarpImage(spline, dest2, scalingMatrix2D(0.5));

show deprecated examples

FImage src(width, height);
SplineImageView<3, Image::value_type> spline(srcImageRange(src));
FImage dest1(width, height);
// equivalent (up to round-off errors) with
// rotateImage(spline, destImage(dest1), 45.0);
TinyVector<double, 2> center((width-1.0)/2.0, (height-1.0)/2.0);
affineWarpImage(spline, destImageRange(dest1), rotationMatrix2DDegrees(45.0, center));
FImage dest2(2*width-1, 2*height-1);
// equivalent (up to round-off errors) with
// resizeImageSplineInterpolation(srcImageRange(img), destImageRange(dest2));
// note that scaleFactor = 0.5, because we must pass the transformation from destination to source
affineWarpImage(spline, destImageRange(dest2), scalingMatrix2D(0.5));

Required Interface:

DestImageIterator dest_upperleft;
double x = ..., y = ...;
if (spline.isInside(x,y))
dest_accessor.set(spline(x, y), dest_upperleft);

See also: Functions to specify affine transformation: translationMatrix2D(), scalingMatrix2D(), shearMatrix2D(), rotationMatrix2DRadians(), rotationMatrix2DDegrees()

void vigra::rotateImage | ( |  | ... | ) |

Rotate an image by a multiple of 90 degrees or by an arbitrary angle.

If you specify the angle as an integer which is a multiple of 90 degrees, rotateImage() just copies the pixels in the appropriate new order. It expects the destination image to have the correct shape for the desired rotation. That is, when the rotation is a multiple of 180 degrees, source and destination must have the same shape, otherwise destination must have the transposed shape of the source.

If you want to rotate by an arbitrary angle and around an arbitrary center point, you must specify the source image as a vigra::SplineImageView, which is used for interpolation at the required subpixel positions. If no center point is provided, the image center is used by default. The destination image must have the same size as the source SplineImageView.

Positive angles refer to counter-clockwise rotation, negative ones to clockwise rotation. All angles must be given in degrees.

Declarations:

pass 2D array views:

namespace vigra {
// rotate by a multiple of 90 degrees
template <class T1, class S1,
class T2, class S2>
void
rotateImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
int rotation);
// rotate by an arbitrary angle around the given center point
template <int ORDER, class T,
class T2, class S2>
void
rotateImage(SplineImageView<ORDER, T> const & src,
MultiArrayView<2, T2, S2> dest,
double angleInDegree,
TinyVector<double, 2> const & center = (src.shape() - Shape2(1)) / 2.0);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// rotate by a multiple of 90 degrees
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
rotateImage(SrcIterator is, SrcIterator end, SrcAccessor as,
DestIterator id, DestAccessor ad, int rotation);
// rotate by an arbitrary angle around the given center point
template <int ORDER, class T,
class DestIterator, class DestAccessor>
void rotateImage(SplineImageView<ORDER, T> const & src,
DestIterator id, DestAccessor dest,
double angleInDegree, TinyVector<double, 2> const & center = (src.shape() - Shape2(1)) / 2.0);
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
// rotate by a multiple of 90 degrees
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
rotateImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest, int rotation);
// rotate by an arbitrary angle around the given center point
template <int ORDER, class T,
class DestIterator, class DestAccessor>
void
rotateImage(SplineImageView<ORDER, T> const & src,
pair<DestImageIterator, DestAccessor> dest,
double angleInDegree, TinyVector<double, 2> const & center = (src.shape() - Shape2(1)) / 2.0);
}

Usage:

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

// rotate counter-clockwise by 90 degrees (no interpolation required)
MultiArray<2, float> src(width, height),
dest(height, width); // note that width and height are exchanged
... // fill src
rotateImage(src, dest, 90);
// rotate clockwise by 38.5 degrees, using a SplieImageView for cubic interpolation
SplineImageView<3, float> spline(srcImageRange(src));
MultiArray<2, float> dest2(src.shape());
vigra::rotateImage(spline, dest2, -38.5);

show deprecated examples

// rotate counter-clockwise by 90 degrees (no interpolation required)
BImage src(width, height),
dest(height, width); // note that width and height are exchanged
... // fill src
rotateImage(srcImageRange(src), destImage(dest), 90);
// rotate clockwise by 38.5 degrees, using a SplieImageView for cubic interpolation
SplineImageView<3, float> spline(srcImageRange(src));
FImage dest2(width, height);
rotateImage(spline, destImage(dest), -38.5);

Required Interface:

SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
dest_accessor.set(src_accessor(src_upperleft), dest_upperleft);

Preconditions:

src.shape(0) > 1 && src.shape(1) > 1

void vigra::reflectImage | ( |  | ... | ) |

Reflect image horizontally or vertically.

The reflection direction refers to the reflection axis, i.e. horizontal reflection turns the image upside down, vertical reflection changes left for right. The directions are selected by the enum values `vigra::horizontal` and `vigra::vertical`. The two directions can also be "or"ed together to perform both reflections simultaneously (see example below) – this is the same as a 180 degree rotation.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
reflectImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest, Reflect reflect);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
reflectImage(SrcIterator is, SrcIterator end, SrcAccessor as,
DestIterator id, DestAccessor ad, Reflect axis);
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
reflectImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest, Reflect axis);
}

Usage:

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

MultiArray<2, float> src(width, height),
dest(width, height);
... // fill src
// reflect about both dimensions
vigra::reflectImage(src, dest, vigra::horizontal | vigra::vertical);

show deprecated examples

BImage src(width, height),
dest(width, height);
... // fill src
vigra::reflectImage(srcImageRange(src), destImage(dest), vigra::horizontal | vigra::vertical);

Required Interface:

SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
dest_accessor.set(src_accessor(src_upperleft), dest_upperleft);

Preconditions:

src.shape(0) > 1 && src.shape(1) > 1

Examples:
  composite.cxx, and mirror_tutorial.cxx.

void vigra::transposeImage | ( |  | ... | ) |

Transpose an image over the major or minor diagonal.

The transposition direction refers to the axis, i.e. major transposition turns the upper right corner into the lower left one, whereas minor transposition changes the upper left corner into the lower right one. The directions are selected by the enum values `vigra::major` and `vigra::minor`. The two directions can also be "or"ed together to perform both reflections simultaneously (see example below) – this is the same as a 180 degree rotation. (Caution: When doing multi-platform development, you should be aware that some <sys/types.h> define major/minor, too. Do not omit the vigra namespace prefix.)

Note that a similar effect can be chieved by MultiArrayView::transpose(). However, the latter can only transpose about the major diagonal, and it doesn't rearrange the data

- it just creates a view with transposed axis ordering. It depends on the context which function is more appropriate.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
transposeImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest, Transpose axis);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
transposeImage(SrcIterator is, SrcIterator end, SrcAccessor as,
DestIterator id, DestAccessor ad, Transpose axis);
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
transposeImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest, Transpose axis);
}

Usage:

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

MultiArray<2, float> src(width, height),
dest(height, width); // note that dimensions are transposed
... // fill src
// transpose about the major diagonal
vigra::transposeImage(src, dest, vigra::major);
// this produces the same data as transposing the view
assert(dest == src.transpose());
// transposition about the minor diagonal has no correspondence in MultiArrayView
vigra::transposeImage(src, dest, vigra::minor);

show deprecated examples

BImage src(width, height),
dest(width, height);
... // fill src
// transpose about both diagonals simultaneously
vigra::transposeImage(srcImageRange(src), destImage(dest), vigra::major | vigra::minor);

Required Interface:

SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
dest_accessor.set(src_accessor(src_upperleft), dest_upperleft);

Preconditions:

src.shape(0) > 1 && src.shape(1) > 1

Examples:
  transpose_image_tutorial.cxx.

void vigra::resampleImage | ( |  | ... | ) |

Resample image by a given factor.

This algorithm is very fast and does not require any arithmetic on the pixel types. The input image must have a size of at least 2x2. Destiniation pixels are directly copied from the appropriate source pixels. The size of the result image is the product of `factor` and the original size, where we round up if `factor < 1.0` and down otherwise. This size calculation is the main difference to the convention used in the similar function resizeImageNoInterpolation(): there, the result size is calculated as `n*(old_width-1)+1` and `n*(old_height-1)+1`. This is because resizeImageNoInterpolation() does not replicate the last pixel of every row/column in order to make it compatible with the other functions of the `resizeImage...` family.

The function can be called with different resampling factors for x and y, or with a single factor to be used for both directions.

It should also be noted that resampleImage() is implemented so that an enlargement followed by the corresponding shrinking reproduces the original image.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
resampleImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest, double factor);
template <class T1, class S1,
class T2, class S2>
void
resampleImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest, double xfactor, double yfactor);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
resampleImage(SrcIterator is, SrcIterator iend, SrcAccessor sa,
DestIterator id, DestAccessor ad, double factor);
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
resampleImage(SrcIterator is, SrcIterator iend, SrcAccessor sa,
DestIterator id, DestAccessor ad, double xfactor, double yfactor);
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
resampleImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest, double factor);
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
resampleImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest, double xfactor, double yfactor);
}

Usage:

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

double factor = 2.0;
MultiArray<2, float> src(width, height),
dest((int)(factor*width), (int)(factor*height)); // enlarge image by factor
... // fill src
resampleImage(src, dest, factor);

show deprecated examples

// use old API
vigra::resampleImage(srcImageRange(src), destImage(dest), factor);

Required Interface:

SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
dest_accessor.set(src_accessor(src_upperleft), dest_upperleft);

Preconditions:

src.shape(0) > 1 && src.shape(1) > 1

void vigra::resizeMultiArraySplineInterpolation | ( |  | ... | ) |

Resize MultiArray using B-spline interpolation.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2,
class Kernel = BSpline<3, double> >
void
resizeMultiArraySplineInterpolation(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
Kernel const & spline = BSpline<3, double>());
}

show deprecated declarations

pass MultiIterators and Data Accessors :
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 function 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

MultiArray<3, float> src(Shape3(5, 7, 10)),
dest(Shape3(9, 13, 19)); // double the size
// use default cubic spline interpolator
resizeMultiArraySplineInterpolation(src, dest);
// use linear interpolator
resizeMultiArraySplineInterpolation(src, dest, BSpline<1, double>());

show deprecated examples

vigra::MultiArray<3, float> src(Shape3(5, 7, 10)),
dest(Shape3(9, 13, 19)); // double the size
// use linear interpolator
vigra::resizeMultiArraySplineInterpolation(srcMultiArrayRange(src),
destMultiArrayRange(dest), BSpline<1, double>());
// 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.

Examples:
  graph_agglomerative_clustering.cxx.

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.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
resizeImageNoInterpolation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
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

MultiArray<2, unsigned char> src(w, h);
MultiArray<2, float> dest(w_new, h_new);
resizeImageNoInterpolation(src, dest);

show deprecated examples

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:

Source and destination must have at least 2 pixels along each axis.

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 compromise 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.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
resizeImageLinearInterpolation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
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

MultiArray<2, unsigned char> src(w, h);
MultiArray<2, float> dest(w_new, h_new);
resizeImageLinearInterpolation(src, dest);

show deprecated examples

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:

Source and destination must have at least 2 pixels along each axis.

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 function 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 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class SPLINE>
void
resizeImageSplineInterpolation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
SPLINE const & spline = BSpline<3, double>());
}

show deprecated declarations

pass Image Iterators and Data Accessors :
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

MultiArray<2, unsigned char> src(w, h);
MultiArray<2, float> dest(w_new, h_new);
// use default cubic spline interpolator
resizeImageSplineInterpolation(src, dest);
// use 5th-order spline interpolator
resizeImageSplineInterpolation(src, dest, BSpline<5, double>());

show deprecated examples

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:

Source and destination must have at least 2 pixels along each axis.

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 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
resizeImageCatmullRomInterpolation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
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

MultiArray<2, unsigned char> src(w, h);
MultiArray<2, float> dest(w_new, h_new);
resizeImageCatmullRomInterpolation(src, dest);

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 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
resizeImageCoscotInterpolation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
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

MultiArray<2, unsigned char> src(w, h);
MultiArray<2, float> dest(w_new, h_new);
resizeImageCoscotInterpolation(src, dest);

© 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.11.0 (Fri May 19 2017)