LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::scaleSpacePyramid< T > Class Template Reference

Image pyramid to represent the scale space. More...

#include <ltiScaleSpacePyramid.h>

Inheritance diagram for lti::scaleSpacePyramid< T >:
Inheritance graph
[legend]
Collaboration diagram for lti::scaleSpacePyramid< T >:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 Parameters for the generation of scaleSpace pyramids. More...

Public Types

enum  eExtremaType { NoExtremum = 0, Minimum, Maximum }
typedef T::value_type value_type

Public Member Functions

 scaleSpacePyramid ()
 scaleSpacePyramid (const int levels, const parameters &par=parameters())
 scaleSpacePyramid (const scaleSpacePyramid< T > &other)
virtual ~scaleSpacePyramid ()
virtual const char * getTypeName () const
scaleSpacePyramid< T > & copy (const scaleSpacePyramid< T > &other)
scaleSpacePyramid< T > & operator= (const scaleSpacePyramid< T > &other)
virtual mathObjectclone () const
void resize (const int &levels, const bool &copyData=true)
virtual bool setParameters (const parameters &par)
const parametersgetParameters () const
void generate (const T &src)
void generate (const T &src, const int &numLevels)
float getScaleForRadius (const float radius) const
float getRadiusForScale (const float scale) const
const double & getLevelScale (const int level) const
eExtremaType interpolateExtremum (const int row, const int col, const int level, float &spRow, float &spCol) const
eExtremaType interpolateExtremum (const int row, const int col, const int level, float &spRow, float &spCol, float &scale) const
bool interpolateMaximum (const int row, const int col, const int level, float &spRow, float &spCol) const
bool interpolateMaximum (const int row, const int col, const int level, float &spRow, float &spCol, float &scale) const
bool checkMaximum (const int row, const int col, const int level) const
bool checkInterlevelMaximum (const int row, const int col, const int level) const
void mapToLevel0 (const int level, const float row, const float col, float &row0, float &col0) const
void mapToLevel (const int level, const float &row0, const float &col0, float &row, float &col) const
void mapToLevel (const int fromLevel, const int toLevel, const float &rowFrom, const float &colFrom, float &rowTo, float &colTo) const
Scale-space access operators

The scale space can be accessed at any real x,y and scale values.

Interpolation is necessary to get a spatial subpixel or a value between scales. The methods can use several one-dimensional interpolations, which is relative fast to compute, or can use more precise but much expensive two or three dimensional interpolation polynoms.

The spatial coordinates are always given with respect to the first level (level 0), which mean they must be between (0,0) and (at(0).lastColumn(),at(0).lastRow()).



value_type nearestAt (const float y, const float x, const int lev) const
value_type bilinearAt (const float y, const float x, const int lev) const
value_type biquadraticAt (const float y, const float x, const int lev) const
value_type quadraticAt (const float y, const float x, const int lev) const
value_type trilinearAt (const float y, const float x, const float s) const
value_type triquadraticAt (const float y, const float x, const float s) const
value_type quadraticAt (const float y, const float x, const float s) const

Protected Member Functions

value_type cstAt (const T &img, const int y, const int x) const
const value_typetacc (const value_type &in, value_type &out) const
void initLevelFactor ()

Protected Attributes

nearestNeighborInterpolator
< value_type
nnIpl
bilinearInterpolator< value_typebilinIpl
biquadraticInterpolator
< value_type
biquadIpl
parameters param
dvector levelFactor

Detailed Description

template<class T>
class lti::scaleSpacePyramid< T >

Image pyramid to represent the scale space.

This pyramid can be used for scale-dependent image access. At construction time the input channel is downsampled to several scales as specified with the resize()-method.

Each channel is downsampled by "factor"-parameter with Gaussian convolution applied. This factor is usually greater than 0.5 (the usual one in image pyramids), but still must be less than 1.0. This is done to archieve a much higher precision.

As with other pyramids, the template type T represents the image type. Usually you will want to use an scaleSpacePyramid<channel>.

For this class the term "level" denotes one of the existent layers of the pyramid. The term "scale" denotes a real value. The "levels" have explicit scales, that can be obtaind with getLevelScale().


Member Typedef Documentation

template<class T>
typedef T::value_type lti::scaleSpacePyramid< T >::value_type

Type of elements of the channels of type T.


Member Enumeration Documentation

template<class T>
enum lti::scaleSpacePyramid::eExtremaType

Type of extrema detected at a given point.

Enumerator:
NoExtremum 

No extremum point has been detected.

Minimum 

A (local) minimum has been detected.

Maximum 

A (local) maximum has been detected.


Constructor & Destructor Documentation

template<class T>
lti::scaleSpacePyramid< T >::scaleSpacePyramid (  ) 

Default constructor.

template<class T>
lti::scaleSpacePyramid< T >::scaleSpacePyramid ( const int  levels,
const parameters par = parameters() 
)

Create a pyramid with the given number of levels and the given parameters.

template<class T>
lti::scaleSpacePyramid< T >::scaleSpacePyramid ( const scaleSpacePyramid< T > &  other  ) 

Copy constructor.

Parameters:
other the object to be copied
template<class T>
virtual lti::scaleSpacePyramid< T >::~scaleSpacePyramid (  )  [virtual]

Destructor.


Member Function Documentation

template<class T>
value_type lti::scaleSpacePyramid< T >::bilinearAt ( const float  y,
const float  x,
const int  lev 
) const

Get an "in level" bilinear interpolation.

The given level lev must be in the pyramid.

template<class T>
value_type lti::scaleSpacePyramid< T >::biquadraticAt ( const float  y,
const float  x,
const int  lev 
) const

Get an "in level" biquadratic interpolation.

The given level lev must be in the pyramid.

template<class T>
bool lti::scaleSpacePyramid< T >::checkInterlevelMaximum ( const int  row,
const int  col,
const int  level 
) const

Check if the given pixel at the given level (in the respective coordinates) is a maximum in the 3x3x3 neighborhood.

Parameters:
row row of the point to be checked. It must be between 0 and at(level).lastRow(), but for the borders false will be always returned, as a "constant boundary" will be always assumed.
col column of the point to be checked. It must be between 0 and at(level).lastColumn(), but for the borders false will be always returned, as a "constant boundary" will be always assumed.
level the level where the maximum has to be checked.
template<class T>
bool lti::scaleSpacePyramid< T >::checkMaximum ( const int  row,
const int  col,
const int  level 
) const

Check if the given pixel at the given level (in the respective coordinate system) is a maximum in the 3x3 neighborhood.

Parameters:
row row of the point to be checked. It must be between 0 and at(level).lastRow(), but for the borders false will be always returned, as a "constant boundary" will be always assumed.
col column of the point to be checked. It must be between 0 and at(level).lastColumn(), but for the borders false will be always returned, as a "constant boundary" will be always assumed.
level the level where the maximum has to be checked.
template<class T>
virtual mathObject* lti::scaleSpacePyramid< T >::clone (  )  const [virtual]

Returns a pointer to a clone of this pyramid.

Reimplemented from lti::pyramid< T >.

template<class T>
scaleSpacePyramid<T>& lti::scaleSpacePyramid< T >::copy ( const scaleSpacePyramid< T > &  other  ) 

Copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::pyramid< T >.

template<class T>
value_type lti::scaleSpacePyramid< T >::cstAt ( const T &  img,
const int  y,
const int  x 
) const [inline, protected]

Access with constant boundary.

template<class T>
void lti::scaleSpacePyramid< T >::generate ( const T &  src,
const int &  numLevels 
)

Generate the pyramid of the given object.

The pyramid will contain the number of resolutions specified by theResolutions.

The level "0" will correspond to the original channel or image. The resolution i+1 is always a parameters::factor times smaller than the level i at each axis.

template<class T>
void lti::scaleSpacePyramid< T >::generate ( const T &  src  ) 

Generate the pyramid of the given object.

The pyramid will contain the number of levels specified in the construction or in the resize() method.

The level "0" will correspond to the original channel or image. The level i+1 is always a parameters::factor times smaller than the level i at each axis.

template<class T>
const double& lti::scaleSpacePyramid< T >::getLevelScale ( const int  level  )  const [inline]

Return the scale for the levels of the pyramid.

template<class T>
const parameters& lti::scaleSpacePyramid< T >::getParameters (  )  const

Get a read-only reference to parameters.

template<class T>
float lti::scaleSpacePyramid< T >::getRadiusForScale ( const float  scale  )  const

Get the radius of one "pixel" for the given level.

At the level 0, the radius of a pixel is 0.5.

template<class T>
float lti::scaleSpacePyramid< T >::getScaleForRadius ( const float  radius  )  const

Get the scale corresponding for a circular area of the given radius.

At the scale 0, the radius of a pixel is 0.5.

template<class T>
virtual const char* lti::scaleSpacePyramid< T >::getTypeName (  )  const [virtual]

Returns the name of this type ("scaleSpacePyramid\<T\>").

Reimplemented from lti::pyramid< T >.

template<class T>
void lti::scaleSpacePyramid< T >::initLevelFactor (  )  [protected]

Initialize the values for the levelFactor.

It assumes that the vector has the proper size.

template<class T>
eExtremaType lti::scaleSpacePyramid< T >::interpolateExtremum ( const int  row,
const int  col,
const int  level,
float &  spRow,
float &  spCol,
float &  scale 
) const

Seaches for an extremum with sub-pixel accuracy in a 3x3x3 region around the given access point.

A 3D quadratic function will be used to compute the sub-pixel values.

This function will only work if the parameters::factor is in ]0.5,1.0[.

Note that in makes only sense to call this method if the (col,row) point of the given level is already a extremum in the discrete coordinates system, i.e. if the point is greater than its 26 neighbors. Otherwise this method will just return "NoExtremum".

Parameters:
row row in coordinates of the given level, i.e. this value must be between 0 and at(level).rows()
col column in coordinates of the given level, i.e. this value must be between 0 and at(level).columns()
level level at which the extremum must be looked for.
spRow in case an extremum is found in the 3x3x3 region, this is the row of the found extremum using the coordinates of the corresponding level.
spCol in case an extremum is found in the 3x3x3 region, this is the column of the found extremum using the coordinates of the corresponding level.
scale in case an extremum is found in the 3x3x3 region, this is the scale of the found extremum.
Returns:
the type of extremum detected. In case a maximum/minimum was found, the spRow, spCol and scale will contain the position with sub-pixel precision of the found extremum.
template<class T>
eExtremaType lti::scaleSpacePyramid< T >::interpolateExtremum ( const int  row,
const int  col,
const int  level,
float &  spRow,
float &  spCol 
) const

Seaches for an extremum with sub-pixel accuracy in a 3x3 region around the given access point.

A 2D quadratic function will be used to compute the sub-pixel values.

Note that it only makes sense to call this method if the (col,row) point of the given level is already a extremum or a minimum in the discrete coordinates system, i.e. if the point is greater (smaller) than its eight neighbors. Otherwise this method will just return "NoExtremum".

Parameters:
row row in coordinates of the given level, i.e. this value must be between 0 and at(level).rows()
col column in coordinates of the given level, i.e. this value must be between 0 and at(level).columns()
level level at which the extremum must be looked for.
spRow in case a extremum is found in the 3x3 region, this is the row of the found extremum using the coordinates of the corresponding level.
spCol in case a extremum is found in the 3x3 region, this is the column of the found extremum using the coordinates of the corresponding level.
Returns:
the type of extremum detected. In case a maximum/minimum was found, the spRow and spCol will contain the position with sub-pixel precision of the found extremum.
template<class T>
bool lti::scaleSpacePyramid< T >::interpolateMaximum ( const int  row,
const int  col,
const int  level,
float &  spRow,
float &  spCol,
float &  scale 
) const

Seaches the maximum with sub-pixel accuracy in a 3x3x3 region around the access point.

A 3D quadratic function will be used to compute the sub-pixel values.

This function will only work if the parameters::factor is in ]0.5,1.0[.

Note that in makes only sense to call this method if the (col,row) point of the given level is already a maximum in the discrete coordinates system, i.e. if the point is greater than its 26 neighbors. Otherwise this method will just return false

Parameters:
row row in coordinates of the given level, i.e. this value must be between 0 and at(level).rows()
col column in coordinates of the given level, i.e. this value must be between 0 and at(level).columns()
level level at which the maximum must be looked for.
spRow in case a maximum is found in the 3x3x3 region, this is the row of the found extremum using the coordinates of the corresponding level.
spCol in case an maximum is found in the 3x3x3 region, this is the column of the found extremum using the coordinates of the corresponding level.
scale in case an maximum is found in the 3x3x3 region, this is the scale of the found extremum.
Returns:
true if a maximum was found within the 3x3 region. In this case the spRow and spCol will contain the position with sub-pixel precision of the found maximum. In case there is a maximum, but not in the 3x3 region, or only a minimum or saddle point is found, then false will be returned.
template<class T>
bool lti::scaleSpacePyramid< T >::interpolateMaximum ( const int  row,
const int  col,
const int  level,
float &  spRow,
float &  spCol 
) const

Seaches the maximum with sub-pixel accuracy in a 3x3 region around the access point.

A 2D quadratic function will be used to compute the sub-pixel values.

Note that in makes only sense to call this method if the (col,row) point of the given level is already a maximum in the discrete coordinates system, i.e. if the point is greater than its eight neighbors. Otherwise this method will just return false

Parameters:
row row in coordinates of the given level, i.e. this value must be between 0 and at(level).rows()
col column in coordinates of the given level, i.e. this value must be between 0 and at(level).columns()
level level at which the maximum must be looked for.
spRow in case a maximum is found in the 3x3 region, this is the row of the found maximum using the coordinates of the corresponding level.
spCol in case a maximum is found in the 3x3 region, this is the column of the found maximum using the coordinates of the corresponding level.
Returns:
true if a maximum was found within the 3x3 region. In this case the spRow and spCol will contain the position with sub-pixel precision of the found maximum. In case there is a maximum, but not in the 3x3 region, or only a minimum or saddle point is found, then false will be returned.
template<class T>
void lti::scaleSpacePyramid< T >::mapToLevel ( const int  fromLevel,
const int  toLevel,
const float &  rowFrom,
const float &  colFrom,
float &  rowTo,
float &  colTo 
) const [inline]

Map the coordinates from level "from" to level "to".

template<class T>
void lti::scaleSpacePyramid< T >::mapToLevel ( const int  level,
const float &  row0,
const float &  col0,
float &  row,
float &  col 
) const [inline]

Map the coordinates of level 0 into the coordinates of the given level.

template<class T>
void lti::scaleSpacePyramid< T >::mapToLevel0 ( const int  level,
const float  row,
const float  col,
float &  row0,
float &  col0 
) const [inline]

Map the coordinates of the given level into coordinates of level 0.

template<class T>
value_type lti::scaleSpacePyramid< T >::nearestAt ( const float  y,
const float  x,
const int  lev 
) const

Get an "in level" nearest neighbor interpolation.

The given level lev must be in the pyramid.

template<class T>
scaleSpacePyramid<T>& lti::scaleSpacePyramid< T >::operator= ( const scaleSpacePyramid< T > &  other  ) 

Alias for copy member.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::pyramid< T >.

template<class T>
value_type lti::scaleSpacePyramid< T >::quadraticAt ( const float  y,
const float  x,
const float  s 
) const

Compute for the given (x,y) spatial coordinates three "in-level" quadratic interpolations at the three nearest levels of the given scale s, and from the three new values interpolate quadratically for the corresponding scale value.

The given scale s must be in the pyramid, i.e. s>=0 and s<=parametersfactor^(size()-1)

This is therefore a combination between 2D and 1D quadratic interpolations.

Note that if the scale s is integer it is faster to call the other quadraticAt method that expects the level of the pyramid.

See also:
quadraticAt(const float,const float,const int) const;
template<class T>
value_type lti::scaleSpacePyramid< T >::quadraticAt ( const float  y,
const float  x,
const int  lev 
) const

Get an "in level" quadratic interpolation.

The given level lev must be in the pyramid.

Since the pixel (x,y) at level lev has eight neighbors and the quadratic function only six coefficients, the least square error quadratic surface passing exactly through the middle point will be computed, i.e. five of the six coefficients will be determined using the eight neighbor points of the middle one.

Please note that there is an overload of this function for a scale value s instead of a level, which does a similar task but also interpolates between levels (see quadraticAt(const float,const float,const float)).

template<class T>
void lti::scaleSpacePyramid< T >::resize ( const int &  levels,
const bool &  copyData = true 
) [virtual]

Change the number of resolutions of the pyramid.

Parameters:
levels the new number of levels or layers of the pyramid
copyData if true (default), the old data will be keeped. If false, all data will be lost.

Reimplemented from lti::pyramid< T >.

template<class T>
virtual bool lti::scaleSpacePyramid< T >::setParameters ( const parameters par  )  [virtual]
template<class T>
const value_type& lti::scaleSpacePyramid< T >::tacc ( const value_type in,
value_type out 
) const [inline, protected]

This "transparent" accumulator returns the first input value, while it accumulates in the second variable.

template<class T>
value_type lti::scaleSpacePyramid< T >::trilinearAt ( const float  y,
const float  x,
const float  s 
) const

Get a "between-scales" trilinear interpolation.

The given scale s must be in the pyramid, i.e. s>=0 and s<=parametersfactor^size()-1

template<class T>
value_type lti::scaleSpacePyramid< T >::triquadraticAt ( const float  y,
const float  x,
const float  s 
) const

Get an "between-scales" triquadratic interpolation.

The given scale s must be in the pyramid, i.e. s>=0 and s<=parametersfactor^size()-1


Member Data Documentation

template<class T>
bilinearInterpolator<value_type> lti::scaleSpacePyramid< T >::bilinIpl [protected]

Functor used to bilinear interpolate.

Functor used to biquadratic interpolate.

template<class T>
dvector lti::scaleSpacePyramid< T >::levelFactor [protected]

Vector containing the real scaling factors used for each level in the pyramid.

Functor used for nearest neighbor interpolation.

template<class T>
parameters lti::scaleSpacePyramid< T >::param [protected]

The parameters in use.


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

Generated on Sat Apr 10 15:27:48 2010 for LTI-Lib by Doxygen 1.6.1