Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Attributes | List of all members
vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR > Class Template Reference

interpolation at non-integer positions. More...

#include <Interpolators.h>

Public Types

typedef VALUETYPE value_type
 the iterators' pixel type More...
 

Public Member Functions

 InterpolatingAccessor (ACCESSOR a, INTERPOLATOR inter)
 init from given accessor More...
 
template<class ITERATOR >
value_type operator() (ITERATOR const &i, float x, float y) const
 Interpolate the data item at a non-integer position x, y. More...
 
template<class ITERATOR , class ALPHAITERATOR , class ALPHAACCESSOR >
bool operator() (ITERATOR const &i, std::pair< ALPHAITERATOR, ALPHAACCESSOR > const &alpha, float x, float y, value_type &result) const
 Interpolate the data item at a non-integer position x, y. More...
 

Private Attributes

ACCESSOR a_
 
INTERPOLATOR inter_x
 
INTERPOLATOR inter_y
 

Detailed Description

template<class ACCESSOR, class VALUETYPE, class INTERPOLATOR>
class vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >

interpolation at non-integer positions.

This accessor allows an image be accessed at arbitrary non-integer coordinates and performs an interpolation to obtain a pixel value. It uses the given ACCESSOR (which is usually the accessor originally associated with the iterator) to access data.

The interpolation algorithm is given as a template parameter, INTERPOLATOR. See the interp_bilin interp_cubic, interp_spline16, interp_spline36, interp_spline64 and interp_sinc for possible interpolators

Namespace: vigra

Usage

// used variables:
// iterator : pointing to upperLeft
// accessor : accessor to the source image
// dest : value, interpolated at sx, m_sIter (relative to iterator)
interp_cubic iterp;
typename SrcAccessor::value_type,Interpolator> interpol(accessor, interp);
...
double sx = 102.1;
double m_sIter = 58,81;
dest = interpol(iterator, sx, m_sIter);
<b> Required Interface:</b>
\code
ITERATOR iter;
ACCESSOR a;
VALUETYPE destvalue;
INTERPOLATOR interp;
const int interp.size;
float s;
int x, y;
void interp::calc_coeff(double x);
destvalue = s * a(iter, x, y) + s * a(iter, x, y);

Definition at line 857 of file Interpolators.h.

Member Typedef Documentation

template<class ACCESSOR , class VALUETYPE , class INTERPOLATOR >
typedef VALUETYPE vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::value_type

the iterators' pixel type

Definition at line 862 of file Interpolators.h.

Constructor & Destructor Documentation

template<class ACCESSOR , class VALUETYPE , class INTERPOLATOR >
vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::InterpolatingAccessor ( ACCESSOR  a,
INTERPOLATOR  inter 
)
inline

init from given accessor

Definition at line 866 of file Interpolators.h.

Member Function Documentation

template<class ACCESSOR , class VALUETYPE , class INTERPOLATOR >
template<class ITERATOR >
value_type vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::operator() ( ITERATOR const &  i,
float  x,
float  y 
) const
inline

Interpolate the data item at a non-integer position x, y.

be careful, no bounds checking is done here. take INTERPOLATOR::size into accout before iterating over the picture.

the used image pixels are [i-(n/2 -1) .. i+n/2], where n is the size of the interpolator

Parameters
ibase iterator
xx position, relative to i and alpha.first
yy position, relative to i and alpha.first
Returns
interpolation result

Definition at line 887 of file Interpolators.h.

References vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::a_, vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::inter_x, and vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::inter_y.

template<class ACCESSOR , class VALUETYPE , class INTERPOLATOR >
template<class ITERATOR , class ALPHAITERATOR , class ALPHAACCESSOR >
bool vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::operator() ( ITERATOR const &  i,
std::pair< ALPHAITERATOR, ALPHAACCESSOR > const &  alpha,
float  x,
float  y,
value_type result 
) const
inline

Interpolate the data item at a non-integer position x, y.

It checks if the interpolation would access a pixel with alpha = 0 and returns false in that case.

be careful, no bounds checking is done here. take INTERPOLATOR::size into accout before iterating over the picture.

the used image pixels are [i-(n/2 -1) .. i+n/2], where n is the size of the interpolator

Parameters
ibase iterator
alphaalpha image
xx position, relative to i and alpha.first
yy position, relative to i and alpha.first
resultthe interpolation result
Returns
true if interpolation ok, false if one or more pixels were masked out

Definition at line 937 of file Interpolators.h.

References vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::a_, vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::inter_x, and vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::inter_y.

Member Data Documentation

template<class ACCESSOR , class VALUETYPE , class INTERPOLATOR >
ACCESSOR vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::a_
private
template<class ACCESSOR , class VALUETYPE , class INTERPOLATOR >
INTERPOLATOR vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::inter_x
private
template<class ACCESSOR , class VALUETYPE , class INTERPOLATOR >
INTERPOLATOR vigra_ext::InterpolatingAccessor< ACCESSOR, VALUETYPE, INTERPOLATOR >::inter_y
private

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