[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
Create a continuous view onto a discrete image using splines. More...
#include <vigra/splineimageview.hxx>
Public Types | |
typedef TinyVector< double, 2 > | difference_type |
typedef BasicImage< InternalValue > | InternalImage |
typedef Size2D | size_type |
typedef NormTraits< VALUETYPE >::SquaredNormType | SquaredNormType |
typedef VALUETYPE | value_type |
Static Public Attributes | |
static constexpr int | order = ORDER |
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, since they exploit the regularity of the sampling grid.
The SplineImageView
template is explicitly specialized to make it as efficient as possible. In particular, unnecessary copying of the image is avoided when the iterators passed in the constructor originate from a vigra::BasicImage. In addition, these specializations provide function unchecked(...)
that do not perform bounds checking. If the original image is not a variant of vigra::BasicImage, one can customize the internal representation by using vigra::SplineImageView0 or vigra::SplineImageView1.
Usage:
#include <vigra/splineimageview.hxx>
Namespace: vigra
The view's value type (return type of access and derivative functions).
typedef NormTraits<VALUETYPE>::SquaredNormType SquaredNormType |
The view's squared norm type (return type of g2() etc.).
The view's difference type.
typedef BasicImage<InternalValue> InternalImage |
The type of the internal image holding the spline coefficients.
SplineImageView | ( | MultiArrayView< 2, U, S > const & | s, |
bool | skipPrefiltering = false |
||
) |
Construct SplineImageView for a 2D MultiArrayView.
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 | ( | SrcIterator | is, |
SrcIterator | iend, | ||
SrcAccessor | sa, | ||
bool | skipPrefiltering = false |
||
) |
Construct SplineImageView for an image given by Image Iterators and Data Accessors.
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 |
||
) |
Construct SplineImageView for an image given by Argument Object Factories.
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.
Access interpolated function at real-valued coordinate (x, y)
. If (x, y)
is near the image border or outside the image, the value is calculated with reflective boundary conditions. An exception is thrown if the coordinate is outside the first reflection.
Access derivative of order (dx, dy)
at real-valued coordinate (x, y)
. If (x, y)
is near the image border or outside the image, the value is calculated with reflective boundary conditions. An exception is thrown if the coordinate is outside the first reflection.
Access 1st derivative in x-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 1, 0)
.
Access 1st derivative in y-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 0, 1)
.
Access 2nd derivative in x-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 2, 0)
.
Access mixed 2nd derivative at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 1, 1)
.
Access 2nd derivative in y-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 0, 2)
.
Access 3rd derivative in x-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 3, 0)
.
Access 3rd derivative in y-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 0, 3)
.
Access mixed 3rd derivative dxxy at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 2, 1)
.
Access mixed 3rd derivative dxyy at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 1, 2)
.
value_type operator() | ( | difference_type const & | d | ) | const |
Access interpolated function at real-valued coordinate d
. Equivalent to splineView(d[0], d[1])
.
value_type operator() | ( | difference_type const & | d, |
unsigned int | dx, | ||
unsigned int | dy | ||
) | const |
Access derivative of order (dx, dy)
at real-valued coordinate d
. Equivalent to splineView(d[0], d[1], dx, dy)
.
value_type dx | ( | difference_type const & | d | ) | const |
Access 1st derivative in x-direction at real-valued coordinate d
. Equivalent to splineView.dx(d[0], d[1])
.
value_type dy | ( | difference_type const & | d | ) | const |
Access 1st derivative in y-direction at real-valued coordinate d
. Equivalent to splineView.dy(d[0], d[1])
.
value_type dxx | ( | difference_type const & | d | ) | const |
Access 2nd derivative in x-direction at real-valued coordinate d
. Equivalent to splineView.dxx(d[0], d[1])
.
value_type dxy | ( | difference_type const & | d | ) | const |
Access mixed 2nd derivative at real-valued coordinate d
. Equivalent to splineView.dxy(d[0], d[1])
.
value_type dyy | ( | difference_type const & | d | ) | const |
Access 2nd derivative in y-direction at real-valued coordinate d
. Equivalent to splineView.dyy(d[0], d[1])
.
value_type dx3 | ( | difference_type const & | d | ) | const |
Access 3rd derivative in x-direction at real-valued coordinate d
. Equivalent to splineView.dx3(d[0], d[1])
.
value_type dy3 | ( | difference_type const & | d | ) | const |
Access 3rd derivative in y-direction at real-valued coordinate d
. Equivalent to splineView.dy3(d[0], d[1])
.
value_type dxxy | ( | difference_type const & | d | ) | const |
Access mixed 3rd derivative dxxy at real-valued coordinate d
. Equivalent to splineView.dxxy(d[0], d[1])
.
value_type dxyy | ( | difference_type const & | d | ) | const |
Access mixed 3rd derivative dxyy at real-valued coordinate d
. Equivalent to splineView.dxyy(d[0], d[1])
.
SplineImageView< ORDER, VALUETYPE >::SquaredNormType g2 | ( | double | x, |
double | y | ||
) | const |
Access gradient squared magnitude at real-valued coordinate (x, y)
.
SplineImageView< ORDER, VALUETYPE >::SquaredNormType g2x | ( | double | x, |
double | y | ||
) | const |
Access 1st derivative in x-direction of gradient squared magnitude at real-valued coordinate (x, y)
.
SplineImageView< ORDER, VALUETYPE >::SquaredNormType g2y | ( | double | x, |
double | y | ||
) | const |
Access 1st derivative in y-direction of gradient squared magnitude at real-valued coordinate (x, y)
.
SplineImageView< ORDER, VALUETYPE >::SquaredNormType g2xx | ( | double | x, |
double | y | ||
) | const |
Access 2nd derivative in x-direction of gradient squared magnitude at real-valued coordinate (x, y)
.
SplineImageView< ORDER, VALUETYPE >::SquaredNormType g2xy | ( | double | x, |
double | y | ||
) | const |
Access mixed 2nd derivative of gradient squared magnitude at real-valued coordinate (x, y)
.
SplineImageView< ORDER, VALUETYPE >::SquaredNormType g2yy | ( | double | x, |
double | y | ||
) | const |
Access 2nd derivative in y-direction of gradient squared magnitude at real-valued coordinate (x, y)
.
SquaredNormType g2 | ( | difference_type const & | d | ) | const |
Access gradient squared magnitude at real-valued coordinate d
.
SquaredNormType g2x | ( | difference_type const & | d | ) | const |
Access 1st derivative in x-direction of gradient squared magnitude at real-valued coordinate d
.
SquaredNormType g2y | ( | difference_type const & | d | ) | const |
Access 1st derivative in y-direction of gradient squared magnitude at real-valued coordinate d
.
SquaredNormType g2xx | ( | difference_type const & | d | ) | const |
Access 2nd derivative in x-direction of gradient squared magnitude at real-valued coordinate d
.
SquaredNormType g2xy | ( | difference_type const & | d | ) | const |
Access mixed 2nd derivative of gradient squared magnitude at real-valued coordinate d
.
SquaredNormType g2yy | ( | difference_type const & | d | ) | const |
Access 2nd derivative in y-direction of gradient squared magnitude at real-valued coordinate d
.
The width of the image. 0 <= x <= width()-1
is required for all access functions.
The height of the image. 0 <= y <= height()-1
is required for all access functions.
The shape of the image. Same as size(), except for the return type.
InternalImage const & image | ( | ) | const |
The internal image holding the spline coefficients.
Get the array of polynomial coefficients for the facet containing the point (x, y)
. The array res
must have dimension (ORDER+1)x(ORDER+1)
. From these coefficients, the value of the interpolated function can be calculated by the following algorithm
Check if x is in the original image range. Equivalent to 0 <= x <= width()-1
.
Check if y is in the original image range. Equivalent to 0 <= y <= height()-1
.
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)
.
The order of the spline used.
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |