Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

VL::Sift Class Reference

SIFT filter. More...

#include <sift.hpp>


Detailed Description

SIFT filter.

This class is a filter computing the Scale Invariant Feature Transform (SIFT).

Definition at line 170 of file sift.hpp.

List of all members.

Classes

struct  Keypoint
 SIFT keypoint. More...

Public Types

typedef std::vector< KeypointKeypoints
 Keypoint list datatype.
typedef Keypoints::iterator KeypointsIter
 Keypoint list iter datatype.
typedef Keypoints::const_iterator KeypointsConstIter
 Keypoint list const iter datatype.

Public Member Functions

void process (const pixel_t *_im_pt, int _width, int _height)
 Compute Gaussian Scale Space.

 Sift (const pixel_t *_im_pt, int _width, int _height, float_t _sigman, float_t _sigma0, int _O, int __S, int _omin, int _smin, int _smax)
 Constructors and destructors.
 ~Sift ()

VL::pixel_tgetOctave (int o)
 Querying the Gaussian scale space.
VL::pixel_tgetLevel (int o, int s)
 Get level.
int getWidth () const
 Get width of source image.
int getHeight () const
 Get height of source image.
int getOctaveWidth (int o) const
 Get width of an octave.
int getOctaveHeight (int o) const
 Get height of an octave.
VL::float_t getOctaveSamplingPeriod (int o) const
 Get octave sampling period.
VL::float_t getScaleFromIndex (VL::float_t o, VL::float_t s) const
 Convert index into scale.
Keypoint getKeypoint (VL::float_t x, VL::float_t y, VL::float_t s) const
 Get keypoint from position and scale.

bool getNormalizeDescriptor () const
 Descriptor parameters.
void setNormalizeDescriptor (bool)
 Set normalize descriptor flag.
void setMagnification (VL::float_t)
 Set descriptor magnification.
VL::float_t getMagnification () const
 Get descriptor magnification.

void detectKeypoints (VL::float_t threshold, VL::float_t edgeThreshold)
 Detector and descriptor.
int computeKeypointOrientations (VL::float_t angles[4], Keypoint keypoint)
 Compute the orientation(s) of a keypoint.
void computeKeypointDescriptor (VL::float_t *descr_pt, Keypoint keypoint, VL::float_t angle)
 SIFT descriptor.
KeypointsIter keypointsBegin ()
 Get keypoint list begin.
KeypointsIter keypointsEnd ()
 Get keypoint list end.

Private Member Functions

void prepareBuffers ()
void freeBuffers ()
 Free buffers.
void smooth (VL::pixel_t *dst, VL::pixel_t *temp, VL::pixel_t const *src, int width, int height, VL::float_t s)
 Smooth an image.
void prepareGrad (int o)
 Compute modulus and phase of the gradient.
 Sift (const Sift &)
Siftoperator= (const Sift &)

Private Attributes

VL::float_t sigman
VL::float_t sigma0
VL::float_t sigmak
int O
int S
int omin
int smin
int smax
int width
int height
VL::float_t magnif
bool normalizeDescriptor
VL::pixel_ttemp
int tempReserved
bool tempIsGrad
int tempOctave
VL::pixel_t ** octaves
VL::pixel_tfilter
int filterReserved
Keypoints keypoints

Member Typedef Documentation

typedef std::vector<Keypoint> VL::Sift::Keypoints

Keypoint list datatype.

Definition at line 202 of file sift.hpp.

typedef Keypoints::const_iterator VL::Sift::KeypointsConstIter

Keypoint list const iter datatype.

Definition at line 204 of file sift.hpp.

typedef Keypoints::iterator VL::Sift::KeypointsIter

Keypoint list iter datatype.

Definition at line 203 of file sift.hpp.


Constructor & Destructor Documentation

VL::Sift::Sift ( const pixel_t _im_pt,
int  _width,
int  _height,
VL::float_t  _sigman,
VL::float_t  _sigma0,
int  _O,
int  __S,
int  _omin,
int  _smin,
int  _smax 
)

Constructors and destructors.

Initialize Gaussian scale space parameters.

Parameters:
_im_pt Source image data
_width Soruce image width
_height Soruce image height
_sigman Nominal smoothing value of the input image.
_sigma0 Base smoothing level.
_O Number of octaves.
__S Number of levels per octave.
_omin First octave.
_smin First level in each octave.
_smax Last level in each octave.

Definition at line 382 of file sift.cc.

VL::Sift::~Sift (  ) 

rief Destroy SIFT filter.

Definition at line 415 of file sift.cc.

VL::Sift::Sift ( const Sift  )  [private]

Member Function Documentation

void VL::Sift::computeKeypointDescriptor ( VL::float_t descr_pt,
Keypoint  keypoint,
VL::float_t  angle0 
)

SIFT descriptor.

The function computes the descriptor of the keypoint keypoint. The function fills the buffer descr_pt which must be large enough. The funciton uses angle0 as rotation of the keypoint. By calling the function multiple times, different orientations can be evaluated.

Remarks:
The function needs to compute the gradient modululs and orientation of the Gaussian scale space octave to which the keypoint belongs. The result is cached, but discarded if different octaves are visited. Thereofre it is much quicker to evaluate the keypoints in their natural octave order.

The function silently abort the computations of keypoints without the scale space boundaries. See also siftComputeOrientations().

Definition at line 1232 of file sift.cc.

Referenced by siftdriver().

int VL::Sift::computeKeypointOrientations ( VL::float_t  angles[4],
Keypoint  keypoint 
)

Compute the orientation(s) of a keypoint.

The function computes the orientation of the specified keypoint. The function returns up to four different orientations, obtained as strong peaks of the histogram of gradient orientations (a keypoint can theoretically generate more than four orientations, but this is very unlikely).

Remarks:
The function needs to compute the gradient modululs and orientation of the Gaussian scale space octave to which the keypoint belongs. The result is cached, but discarded if different octaves are visited. Thereofre it is much quicker to evaluate the keypoints in their natural octave order.

The keypoint must lie within the scale space. In particular, the scale index is supposed to be in the range smin+1 and smax-1 (this is from the SIFT detector). If this is not the case, the computation is silently aborted and no orientations are returned.

Parameters:
angles buffers to store the resulting angles.
keypoint keypoint to process.
Returns:
number of orientations found.

Definition at line 1059 of file sift.cc.

Referenced by siftdriver().

void VL::Sift::detectKeypoints ( VL::float_t  threshold,
VL::float_t  edgeThreshold 
)

Detector and descriptor.

Sift detector.

The function runs the SIFT detector on the stored Gaussian scale space (see process()). The detector consists in three steps

  • local maxima detection;
  • subpixel interpolation;
  • rejection of weak keypoints (threhsold);
  • rejection of keypoints on edge-like structures (edgeThreshold).

As they are found, keypoints are added to an internal list. This list can be accessed by means of the member functions getKeypointsBegin() and getKeypointsEnd(). The list is ordered by octave, which is usefult to speed-up computeKeypointOrientations() and computeKeypointDescriptor().

Definition at line 700 of file sift.cc.

Referenced by siftdriver().

void VL::Sift::freeBuffers (  )  [private]

Free buffers.

This function releases any buffer allocated by prepareBuffers().

See also:
prepareBuffers().

Definition at line 459 of file sift.cc.

Referenced by prepareBuffers(), and ~Sift().

int VL::Sift::getHeight (  )  const

Get height of source image.

Returns:
height.

Definition at line 76 of file sift.ipp.

Sift::Keypoint VL::Sift::getKeypoint ( VL::float_t  x,
VL::float_t  y,
VL::float_t  sigma 
) const

Get keypoint from position and scale.

The function returns a keypoint with a given position and scale. Note that the keypoint structure contains fields that make sense only in conjunction with a specific scale space. Therefore the keypoint structure should be re-calculated whenever the filter is applied to a new image, even if the parameters x, y and sigma do not change.

Parameters:
x x-coordinate of the center.
y y-coordinate of the center.
sigma scale.
Returns:
Corresponing keypoint.

Definition at line 499 of file sift.cc.

Referenced by siftdriver().

VL::pixel_t * VL::Sift::getLevel ( int  o,
int  s 
)

Get level.

Parameters:
o octave index.
s level index.
Returns:
pointer to level (o,s).

Definition at line 124 of file sift.ipp.

Referenced by detectKeypoints(), prepareGrad(), process(), and siftdriver().

VL::float_t VL::Sift::getMagnification (  )  const

Get descriptor magnification.

Definition at line 202 of file sift.ipp.

bool VL::Sift::getNormalizeDescriptor (  )  const

Descriptor parameters.

Get normalize descriptor flag.

Definition at line 186 of file sift.ipp.

VL::pixel_t * VL::Sift::getOctave ( int  o  ) 

Querying the Gaussian scale space.

Get octave.

Parameters:
o octave index.
Returns:
pointer to octave o.

Definition at line 111 of file sift.ipp.

int VL::Sift::getOctaveHeight ( int  o  )  const

Get height of an octave.

Parameters:
o octave index.
Returns:
height of octave o.

Definition at line 99 of file sift.ipp.

Referenced by computeKeypointOrientations(), detectKeypoints(), getLevel(), prepareGrad(), process(), and siftdriver().

VL::float_t VL::Sift::getOctaveSamplingPeriod ( int  o  )  const

Get octave sampling period.

Parameters:
o octave index.
Returns:
Octave sampling period (in pixels).

Definition at line 138 of file sift.ipp.

Referenced by computeKeypointOrientations(), detectKeypoints(), and getKeypoint().

int VL::Sift::getOctaveWidth ( int  o  )  const

Get width of an octave.

Parameters:
o octave index.
Returns:
width of octave o.

Definition at line 87 of file sift.ipp.

Referenced by computeKeypointOrientations(), detectKeypoints(), getLevel(), prepareGrad(), process(), and siftdriver().

VL::float_t VL::Sift::getScaleFromIndex ( VL::float_t  o,
VL::float_t  s 
) const

Convert index into scale.

Parameters:
o octave index.
s scale index.
Returns:
scale.

Definition at line 150 of file sift.ipp.

Referenced by detectKeypoints().

int VL::Sift::getWidth (  )  const

Get width of source image.

Returns:
width.

Definition at line 66 of file sift.ipp.

Sift::KeypointsIter VL::Sift::keypointsBegin (  ) 

Get keypoint list begin.

Returns:
iterator to the beginning.

Definition at line 160 of file sift.ipp.

Referenced by detectKeypoints(), and siftdriver().

Sift::KeypointsIter VL::Sift::keypointsEnd (  ) 

Get keypoint list end.

Returns:
iterator to the end.

Definition at line 170 of file sift.ipp.

Referenced by detectKeypoints(), and siftdriver().

Sift& VL::Sift::operator= ( const Sift  )  [private]
void VL::Sift::prepareBuffers (  )  [private]

Allocate buffers. Buffer sizes depend on the image size and the value of omin.

Definition at line 425 of file sift.cc.

Referenced by process().

void VL::Sift::prepareGrad ( int  o  )  [private]

Compute modulus and phase of the gradient.

The function computes the modulus and the angle of the gradient of the specified octave o. The result is stored in a temporary internal buffer accessed by computeKeypointDescriptor() and computeKeypointOrientations().

The SIFT detector provides keypoint with scale index s in the range smin+1 and smax-2. As such, the buffer contains only these levels.

If called mutliple time on the same data, the function exits immediately.

Parameters:
o octave of interest.

Definition at line 1002 of file sift.cc.

Referenced by computeKeypointOrientations().

void VL::Sift::process ( const pixel_t _im_pt,
int  _width,
int  _height 
)

Compute Gaussian Scale Space.

The method computes the Gaussian scale space of the specified image. The scale space data is managed internally and can be accessed by means of getOctave() and getLevel().

Remarks:
Calling this method will delete the list of keypoints constructed by detectKeypoints().
Parameters:
_im_pt pointer to image data.
_width image width.
_height image height .

Definition at line 611 of file sift.cc.

Referenced by Sift().

void VL::Sift::setMagnification ( VL::float_t  _magnif  ) 

Set descriptor magnification.

Definition at line 194 of file sift.ipp.

Referenced by siftdriver().

void VL::Sift::setNormalizeDescriptor ( bool  flag  ) 

Set normalize descriptor flag.

Definition at line 178 of file sift.ipp.

Referenced by siftdriver().

void VL::Sift::smooth ( VL::pixel_t dst,
VL::pixel_t temp,
VL::pixel_t const *  src,
int  newWidth,
int  newHeight,
VL::float_t  s 
) [private]

Smooth an image.

The function convolves the image src by a Gaussian kernel of variance s and writes the result to dst. The function also needs a scratch buffer dst of the same size of src and dst.

Parameters:
dst output image buffer.
temp scratch image buffer.
src input image buffer.
width width of the buffers.
height height of the buffers.
s standard deviation of the Gaussian kernel.

Definition at line 334 of file sift.cc.

Referenced by process().


Member Data Documentation

Definition at line 283 of file sift.hpp.

Referenced by freeBuffers(), and smooth().

int VL::Sift::filterReserved [private]

Definition at line 284 of file sift.hpp.

Referenced by smooth().

int VL::Sift::height [private]

Definition at line 270 of file sift.hpp.

Referenced by getHeight(), and getOctaveHeight().

Definition at line 286 of file sift.hpp.

Referenced by detectKeypoints(), keypointsBegin(), and keypointsEnd().

Definition at line 273 of file sift.hpp.

Referenced by getMagnification(), and setMagnification().

Definition at line 274 of file sift.hpp.

Referenced by getNormalizeDescriptor(), and setNormalizeDescriptor().

Definition at line 281 of file sift.hpp.

Referenced by freeBuffers(), getLevel(), getOctave(), prepareBuffers(), and process().

int VL::Sift::S [private]

Definition at line 264 of file sift.hpp.

Referenced by getKeypoint(), getScaleFromIndex(), and process().

Definition at line 260 of file sift.hpp.

Referenced by getKeypoint(), getScaleFromIndex(), and process().

Definition at line 261 of file sift.hpp.

Definition at line 259 of file sift.hpp.

Referenced by process().

bool VL::Sift::tempIsGrad [private]

Definition at line 279 of file sift.hpp.

Referenced by detectKeypoints(), prepareBuffers(), and prepareGrad().

int VL::Sift::tempOctave [private]

Definition at line 280 of file sift.hpp.

Referenced by prepareBuffers(), and prepareGrad().

int VL::Sift::tempReserved [private]

Definition at line 278 of file sift.hpp.

Referenced by prepareBuffers().

int VL::Sift::width [private]

Definition at line 269 of file sift.hpp.

Referenced by getOctaveWidth(), and getWidth().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:26 2016 by Doxygen 1.6.3