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

| SplineImageView Class Template Reference |
--- | --- | ---

Create a continuous view onto a discrete image using splines. More...

`#include "vigra/splineimageview.hxx"`

## Public Types

typedef VALUETYPE | value_type
typedef Size2D | size_type
typedef TinyVector< double, 2 > | difference_type
typedef BasicImage< InternalValue > | InternalImage
enum | StaticOrder

## Public Methods

template<class SrcIterator, class SrcAccessor> | SplineImageView (SrcIterator is, SrcIterator iend, SrcAccessor sa, bool skipPrefiltering=false)
template<class SrcIterator, class SrcAccessor> | SplineImageView (triple< SrcIterator, SrcIterator, SrcAccessor > s, bool skipPrefiltering=false)
value_type | operator() (double x, double y) const
value_type | operator() (double x, double y, unsigned int dx, unsigned int dy) const
value_type | dx (double x, double y) const
value_type | dy (double x, double y) const
value_type | dxx (double x, double y) const
value_type | dxy (double x, double y) const
value_type | dyy (double x, double y) const
value_type | dx3 (double x, double y) const
value_type | dy3 (double x, double y) const
value_type | dxxy (double x, double y) const
value_type | dxyy (double x, double y) const
value_type | operator() (difference_type const &d) const
value_type | operator() (difference_type const &d, unsigned int dx, unsigned int dy) const
value_type | dx (difference_type const &d) const
value_type | dy (difference_type const &d) const
value_type | dxx (difference_type const &d) const
value_type | dxy (difference_type const &d) const
value_type | dyy (difference_type const &d) const
value_type | dx3 (difference_type const &d) const
value_type | dy3 (difference_type const &d) const
value_type | dxxy (difference_type const &d) const
value_type | dxyy (difference_type const &d) const
value_type | g2 (double x, double y) const
value_type | g2x (double x, double y) const
value_type | g2y (double x, double y) const
value_type | g2xx (double x, double y) const
value_type | g2xy (double x, double y) const
value_type | g2yy (double x, double y) const
value_type | g2 (difference_type const &d) const
value_type | g2x (difference_type const &d) const
value_type | g2y (difference_type const &d) const
value_type | g2xx (difference_type const &d) const
value_type | g2xy (difference_type const &d) const
value_type | g2yy (difference_type const &d) const
unsigned int | width () const
unsigned int | height () const
size_type | size () const
InternalImage const & | image () const
template<class Array> void | coefficientArray (double x, double y, Array &res) const
bool | isInsideX (double x) const
bool | isInsideY (double y) const
bool | isInside (double x, double y) const
bool | sameFacet (double x0, double y0, double x1, double y1) const

## Detailed Description

### template<int ORDER, class VALUETYPE>
class vigra::SplineImageView< ORDER, VALUETYPE >

Create a continuous view onto a discrete image using splines.

This class is very useful if image values or derivatives at arbitrary real-valued coordinates are needed. Access at such coordinates is implemented by interpolating the given discrete image values with a spline of the specified `ORDER`. Continuous derivatives are available up to degree `ORDER-1`. If the requested coordinates are near the image border, reflective boundary conditions are applied. In principle, this class can also be used for image resizing, but here the functions from the `resize...` family are more efficient.

## Member Typedef Documentation

typedef TinyVector<double, 2> difference_type

| The view's difference type.

typedef BasicImage<InternalValue> InternalImage

| The type of the internal image holding the spline coefficients.

typedef Size2D size_type

| The view's size type.

typedef VALUETYPE value_type

| The view's value type (return type of access and derivative functions).

## Member Enumeration Documentation

enum StaticOrder

| The order of the spline used.

## Constructor & Destructor Documentation

SplineImageView | ( | SrcIterator | is,
|  | SrcIterator | iend,
|  | SrcAccessor | sa,
|  | bool | skipPrefiltering = false
| ) | `[inline]`

| Construct SplineImageView for the given image. If `skipPrefiltering = true` (default: `false`), the recursive prefilter of the cardinal spline function is not applied, resulting in an approximating (smoothing) rather than interpolating spline. This is especially useful if customized prefilters are to be applied.

SplineImageView | ( | triple< SrcIterator, SrcIterator, SrcAccessor > | s,
|  | bool | skipPrefiltering = false
| ) | `[inline]`

| Construct SplineImageView for the given image. If `skipPrefiltering = true` (default: `false`), the recursive prefilter of the cardinal spline function is not applied, resulting in an approximating (smoothing) rather than interpolating spline. This is especially useful if customized prefilters are to be applied.

## Member Function Documentation

void coefficientArray | ( | double | x,
|  | double | y,
|  | Array & | res
| ) | const

Get the array of polynomial coefficients for the facet containing the point `(x, y)`. The array `res` will be resized to dimension `(ORDER+1)x(ORDER+1)`. From these coefficients, the value of the interpolated function can be calculated by the following algorithm

                SplineImageView<ORDER, float> view(...);
                double x = ..., y = ...;
                double dx, dy;

                // calculate the local facet coordinates of x and y
                if(ORDER % 2)
                {
                    // odd order => facet coordinates between 0 and 1
                    dx = x - floor(x);
                    dy = y - floor(y);
                }
                else
                {
                    // even order => facet coordinates between -0.5 and 0.5
                    dx = x - floor(x + 0.5);
                    dy = y - floor(y + 0.5);
                }

                BasicImage<float> coefficients;
                view.coefficientArray(x, y, coefficients);

                float f_x_y = 0.0;
                for(int ny = 0; ny < ORDER + 1; ++ny)
                    for(int nx = 0; nx < ORDER + 1; ++nx)
                        f_x_y += pow(dx, nx) * pow(dy, ny) * coefficients(nx, ny);

                assert(abs(f_x_y - view(x, y)) < 1e-6);

value_type dx | ( | difference_type const & | d | ) | const`[inline]`

| Access 1st derivative in x-direction at real-valued coordinate `d`. Equivalent to `splineView.dx(d[0], d[1])`.

value_type dx | ( | double | x,
|  | double | y
| ) | const`[inline]`

| Access 1st derivative in x-direction at real-valued coordinate `(x, y)`. Equivalent to `splineView(x, y, 1, 0)`.

value_type dx3 | ( | difference_type const & | d | ) | const`[inline]`

| Access 3rd derivative in x-direction at real-valued coordinate `d`. Equivalent to `splineView.dx3(d[0], d[1])`.

value_type dx3 | ( | double | x,
|  | double | y
| ) | const`[inline]`

| Access 3rd derivative in x-direction at real-valued coordinate `(x, y)`. Equivalent to `splineView(x, y, 3, 0)`.

value_type dxx | ( | difference_type const & | d | ) | const`[inline]`

| Access 2nd derivative in x-direction at real-valued coordinate `d`. Equivalent to `splineView.dxx(d[0], d[1])`.

value_type dxx | ( | double | x,
|  | double | y
| ) | const`[inline]`

| Access 2nd derivative in x-direction at real-valued coordinate `(x, y)`. Equivalent to `splineView(x, y, 2, 0)`.

value_type dxxy | ( | difference_type const & | d | ) | const`[inline]`

| Access mixed 3rd derivative dxxy at real-valued coordinate `d`. Equivalent to `splineView.dxxy(d[0], d[1])`.

value_type dxxy | ( | double | x,
|  | double | y
| ) | const`[inline]`

| Access mixed 3rd derivative dxxy at real-valued coordinate `(x, y)`. Equivalent to `splineView(x, y, 2, 1)`.

value_type dxy | ( | difference_type const & | d | ) | const`[inline]`

| Access mixed 2nd derivative at real-valued coordinate `d`. Equivalent to `splineView.dxy(d[0], d[1])`.

value_type dxy | ( | double | x,
|  | double | y
| ) | const`[inline]`

| Access mixed 2nd derivative at real-valued coordinate `(x, y)`. Equivalent to `splineView(x, y, 1, 1)`.

value_type dxyy | ( | difference_type const & | d | ) | const`[inline]`

| Access mixed 3rd derivative dxyy at real-valued coordinate `d`. Equivalent to `splineView.dxyy(d[0], d[1])`.

value_type dxyy | ( | double | x,
|  | double | y
| ) | const`[inline]`

| Access mixed 3rd derivative dxyy at real-valued coordinate `(x, y)`. Equivalent to `splineView(x, y, 1, 2)`.

value_type dy | ( | difference_type const & | d | ) | const`[inline]`

| Access 1st derivative in y-direction at real-valued coordinate `d`. Equivalent to `splineView.dy(d[0], d[1])`.

value_type dy | ( | double | x,
|  | double | y
| ) | const`[inline]`

| Access 1st derivative in y-direction at real-valued coordinate `(x, y)`. Equivalent to `splineView(x, y, 0, 1)`.

value_type dy3 | ( | difference_type const & | d | ) | const`[inline]`

| Access 3rd derivative in y-direction at real-valued coordinate `d`. Equivalent to `splineView.dy3(d[0], d[1])`.

value_type dy3 | ( | double | x,
|  | double | y
| ) | const`[inline]`

| Access 3rd derivative in y-direction at real-valued coordinate `(x, y)`. Equivalent to `splineView(x, y, 0, 3)`.

value_type dyy | ( | difference_type const & | d | ) | const`[inline]`

| Access 2nd derivative in y-direction at real-valued coordinate `d`. Equivalent to `splineView.dyy(d[0], d[1])`.

value_type dyy | ( | double | x,
|  | double | y
| ) | const`[inline]`

| Access 2nd derivative in y-direction at real-valued coordinate `(x, y)`. Equivalent to `splineView(x, y, 0, 2)`.

value_type g2 | ( | difference_type const & | d | ) | const`[inline]`

| Access gradient squared magnitude at real-valued coordinate `d`.

VALUETYPE g2 | ( | double | x,
|  | double | y
| ) | const

| Access gradient squared magnitude at real-valued coordinate `(x, y)`.

value_type g2x | ( | difference_type const & | d | ) | const`[inline]`

| Access 1st derivative in x-direction of gradient squared magnitude at real-valued coordinate `d`.

VALUETYPE g2x | ( | double | x,
|  | double | y
| ) | const

| Access 1st derivative in x-direction of gradient squared magnitude at real-valued coordinate `(x, y)`.

value_type g2xx | ( | difference_type const & | d | ) | const`[inline]`

| Access 2nd derivative in x-direction of gradient squared magnitude at real-valued coordinate `d`.

VALUETYPE g2xx | ( | double | x,
|  | double | y
| ) | const

| Access 2nd derivative in x-direction of gradient squared magnitude at real-valued coordinate `(x, y)`.

value_type g2xy | ( | difference_type const & | d | ) | const`[inline]`

| Access mixed 2nd derivative of gradient squared magnitude at real-valued coordinate `d`.

VALUETYPE g2xy | ( | double | x,
|  | double | y
| ) | const

| Access mixed 2nd derivative of gradient squared magnitude at real-valued coordinate `(x, y)`.

value_type g2y | ( | difference_type const & | d | ) | const`[inline]`

| Access 1st derivative in y-direction of gradient squared magnitude at real-valued coordinate `d`.

VALUETYPE g2y | ( | double | x,
|  | double | y
| ) | const

| Access 1st derivative in y-direction of gradient squared magnitude at real-valued coordinate `(x, y)`.

value_type g2yy | ( | difference_type const & | d | ) | const`[inline]`

| Access 2nd derivative in y-direction of gradient squared magnitude at real-valued coordinate `d`.

VALUETYPE g2yy | ( | double | x,
|  | double | y
| ) | const

| Access 2nd derivative in y-direction of gradient squared magnitude at real-valued coordinate `(x, y)`.

unsigned int height | ( |  | ) | const`[inline]`

| The height of the image. `0 <= y <= height()-1` is required for all access functions.

InternalImage const& image | ( |  | ) | const`[inline]`

| The internal image holding the spline coefficients.

bool isInside | ( | double | x,
|  | double | y
| ) | const`[inline]`

| Check if x and y are in the valid range. Equivalent to `0 <= x <= width()-1` and `0 <= y <= height()-1`.

bool isInsideX | ( | double | x | ) | const`[inline]`

| Check if x is in the valid range. Equivalent to `0 <= x <= width()-1`.

bool isInsideY | ( | double | y | ) | const`[inline]`

| Check if y is in the valid range. Equivalent to `0 <= y <= height()-1`.

value_type operator() | ( | difference_type const & | d,
|  | unsigned int | dx,
|  | unsigned int | dy
| ) | const`[inline]`

| Access derivative of order `(dx, dy)` at real-valued coordinate `d`. Equivalent to `splineView(d[0], d[1], dx, dy)`.

value_type operator() | ( | difference_type const & | d | ) | const`[inline]`

| Access interpolated function at real-valued coordinate `d`. Equivalent to `splineView(d[0], d[1])`.

VALUETYPE operator() | ( | double | x,
|  | double | y,
|  | unsigned int | dx,
|  | unsigned int | dy
| ) | const

| Access derivative of order `(dx, dy)` at real-valued coordinate `(x, y)`.

VALUETYPE operator() | ( | double | x,
|  | double | y
| ) | const

| Access interpolated function at real-valued coordinate `(x, y)`.

bool sameFacet | ( | double | x0,
|  | double | y0,
|  | double | x1,
|  | double | y1
| ) | const`[inline]`

| Check whether the points `(x0, y0)` and `(x1, y1)` are in the same spline facet. For odd order splines, facets span the range `(floor(x), floor(x)+1) x (floor(y), floor(y)+1)` (i.e. we have integer facet borders), whereas even order splines have facet between half integer values `(floor(x)-0.5, floor(x)+0.5) x (floor(y)-0.5, floor(y)+0.5)`.

size_type size | ( |  | ) | const`[inline]`

| The size of the image. `0 <= x <= size().x-1` and `0 <= y <= size().y-1` are required for all access functions.

unsigned int width | ( |  | ) | const`[inline]`

| The width of the image. `0 <= x <= width()-1` is required for all access functions.

The documentation for this class was generated from the following file:

- vigra/splineimageview.hxx

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