[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
SplineImageView< ORDER, VALUETYPE > Class Template Reference |
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 |
enum | StaticOrder |
typedef VALUETYPE | value_type |
Public Member Functions | |
template<class Array > | |
void | coefficientArray (double x, double y, Array &res) const |
value_type | dx (double x, double y) const |
value_type | dx (difference_type const &d) const |
value_type | dx3 (double x, double y) const |
value_type | dx3 (difference_type const &d) const |
value_type | dxx (double x, double y) const |
value_type | dxx (difference_type const &d) const |
value_type | dxxy (double x, double y) const |
value_type | dxxy (difference_type const &d) const |
value_type | dxy (double x, double y) const |
value_type | dxy (difference_type const &d) const |
value_type | dxyy (double x, double y) const |
value_type | dxyy (difference_type const &d) const |
value_type | dy (double x, double y) const |
value_type | dy (difference_type const &d) const |
value_type | dy3 (double x, double y) const |
value_type | dy3 (difference_type const &d) const |
value_type | dyy (double x, double y) const |
value_type | dyy (difference_type const &d) const |
SquaredNormType | g2 (double x, double y) const |
SquaredNormType | g2 (difference_type const &d) const |
SquaredNormType | g2x (double x, double y) const |
SquaredNormType | g2x (difference_type const &d) const |
SquaredNormType | g2xx (double x, double y) const |
SquaredNormType | g2xx (difference_type const &d) const |
SquaredNormType | g2xy (double x, double y) const |
SquaredNormType | g2xy (difference_type const &d) const |
SquaredNormType | g2y (double x, double y) const |
SquaredNormType | g2y (difference_type const &d) const |
SquaredNormType | g2yy (double x, double y) const |
SquaredNormType | g2yy (difference_type const &d) const |
unsigned int | height () const |
InternalImage const & | image () const |
bool | isInside (double x, double y) const |
bool | isInsideX (double x) const |
bool | isInsideY (double y) const |
bool | isValid (double x, double y) const |
value_type | operator() (double x, double y) const |
value_type | operator() (double x, double y, unsigned int dx, unsigned int dy) const |
value_type | operator() (difference_type const &d) const |
value_type | operator() (difference_type const &d, unsigned int dx, unsigned int dy) const |
bool | sameFacet (double x0, double y0, double x1, double y1) const |
TinyVector< unsigned int, 2 > | shape () const |
size_type | size () const |
template<class U , class S > | |
SplineImageView (MultiArrayView< 2, U, S > const &s, bool skipPrefiltering=false) | |
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) | |
unsigned int | width () const |
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
typedef VALUETYPE value_type |
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.).
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.
enum StaticOrder |
The order of the spline used.
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.
VALUETYPE operator() | ( | double | x, |
double | y | ||
) | const |
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.
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)
. 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.
value_type dx | ( | double | x, |
double | y | ||
) | const |
Access 1st derivative in x-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 1, 0)
.
value_type dy | ( | double | x, |
double | y | ||
) | const |
Access 1st derivative in y-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 0, 1)
.
value_type dxx | ( | double | x, |
double | y | ||
) | const |
Access 2nd derivative in x-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 2, 0)
.
value_type dxy | ( | double | x, |
double | y | ||
) | const |
Access mixed 2nd derivative at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 1, 1)
.
value_type dyy | ( | double | x, |
double | y | ||
) | const |
Access 2nd derivative in y-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 0, 2)
.
value_type dx3 | ( | double | x, |
double | y | ||
) | const |
Access 3rd derivative in x-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 3, 0)
.
value_type dy3 | ( | double | x, |
double | y | ||
) | const |
Access 3rd derivative in y-direction at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 0, 3)
.
value_type dxxy | ( | double | x, |
double | y | ||
) | const |
Access mixed 3rd derivative dxxy at real-valued coordinate (x, y)
. Equivalent to splineView(x, y, 2, 1)
.
value_type dxyy | ( | double | x, |
double | y | ||
) | const |
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
.
unsigned int width | ( | ) | const |
The width of the image. 0 <= x <= width()-1
is required for all access functions.
unsigned int height | ( | ) | const |
The height of the image. 0 <= y <= height()-1
is required for all access functions.
size_type size | ( | ) | const |
TinyVector<unsigned int, 2> shape | ( | ) | const |
The shape of the image. Same as size(), except for the return type.
InternalImage const& image | ( | ) | const |
The internal image holding the spline coefficients.
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
must have dimension (ORDER+1)x(ORDER+1)
. From these coefficients, the value of the interpolated function can be calculated by the following algorithm
bool isInsideX | ( | double | x | ) | const |
Check if x is in the original image range. Equivalent to 0 <= x <= width()-1
.
bool isInsideY | ( | double | y | ) | const |
Check if y is in the original image range. Equivalent to 0 <= y <= height()-1
.
bool isInside | ( | double | x, |
double | y | ||
) | const |
bool isValid | ( | double | x, |
double | y | ||
) | const |
Check if x and y are in the valid range. Points outside the original image range are computed by reflective boundary conditions, but only within the first reflection. Equivalent to -width() + ORDER/2 + 2 < x < 2*width() - ORDER/2 - 2
and -height() + ORDER/2 + 2 < y < 2*height() - ORDER/2 - 2
.
bool sameFacet | ( | double | x0, |
double | y0, | ||
double | x1, | ||
double | y1 | ||
) | const |
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)
.
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|