DVision::SurfSet Class Reference

Collection of surf keypoints + descriptors. More...

#include <SurfSet.h>

List of all members.

Public Member Functions

void Extract (const cv::Mat &image, double hessianTh=400.0, bool extended=false)
void Compute (const cv::Mat &image, const std::vector< cv::KeyPoint > &keypoints, bool extended=false)
int GetDescriptorLength () const
unsigned int size () const
bool empty () const
std::vector< float > get (unsigned int i) const
void Remove (unsigned int i)
void Remove (const std::vector< unsigned int > &ids)
void CalculateCorrespondences (const SurfSet &B, std::vector< int > &A_corr, std::vector< int > &B_corr, std::vector< double > *distances=NULL, bool remove_duplicates=true, double max_ratio=0.6) const
void CalculateFastCorrespondences (const SurfSet &B, std::vector< int > &A_corr, std::vector< int > &B_corr, std::vector< double > *distances=NULL, bool remove_duplicates=true, double max_ratio=0.6)
void RecalculateApproximationTree ()
void Save (const std::string &filename) const
void Load (const std::string &filename)
void SaveCustom (const std::string &filename) const
void LoadCustom (const std::string &filename)

Public Attributes

std::vector< cv::KeyPoint > keys
 KeyPoint collection.
std::vector< float > descriptors
 Descriptors associated to the keypoints.
std::vector< int > laplacians
 Laplacian signs of the keypoints.

Protected Member Functions

void save (cv::FileStorage &fs, int idx) const
void load (cv::FileStorage &fs, int idx)
void extract (const cv::Mat &image, const CvSURFParams &params)
void compute (const cv::Mat &image, const std::vector< cv::KeyPoint > &keypoints, const CvSURFParams &params)
double calculateSqDistance (std::vector< float >::const_iterator ita, std::vector< float >::const_iterator itb, const int L) const
void calculateCorrespondencesNaive (const SurfSet &B, std::vector< int > &A_corr, std::vector< int > &B_corr, std::vector< double > *distances, bool remove_duplicates, double max_ratio) const
void calculateCorrespondencesApproximate (const SurfSet &B, std::vector< int > &A_corr, std::vector< int > &B_corr, std::vector< double > *distances, bool remove_duplicates, double max_ratio)
int getPointOctave (const CvSURFPoint &kpt, const CvSURFParams &params) const

Protected Attributes

cv::flann::Index * m_index
 Flann index.

Friends

class Matches

Detailed Description

Collection of surf keypoints + descriptors.


Member Function Documentation

void DVision::SurfSet::CalculateCorrespondences ( const SurfSet B,
std::vector< int > &  A_corr,
std::vector< int > &  B_corr,
std::vector< double > *  distances = NULL,
bool  remove_duplicates = true,
double  max_ratio = 0.6 
) const

Calculates correspondences between this set and the set B

Parameters:
B other set
A_corr indices of matched points from this set
B_corr indices of matched points from the set B
distances if given, the distance between the correspondences is stored here
remove_duplicates if true, ambiguous matches are discarded
max_ratio max ratio between the two nearest neighbours
void SurfSet::calculateCorrespondencesApproximate ( const SurfSet B,
std::vector< int > &  A_corr,
std::vector< int > &  B_corr,
std::vector< double > *  distances,
bool  remove_duplicates,
double  max_ratio 
) [protected]

Calculates correspondences between this set and the set B by flann

Parameters:
B other set
A_corr indices of matched points from this set
B_corr indices of matched points from the set B
distances the distance between the correspondences is stored here
remove_duplicates if true, ambiguous matches are discarded
max_ratio max ratio between the two nearest neighbours
void DVision::SurfSet::calculateCorrespondencesNaive ( const SurfSet B,
std::vector< int > &  A_corr,
std::vector< int > &  B_corr,
std::vector< double > *  distances,
bool  remove_duplicates,
double  max_ratio 
) const [protected]

Calculates correspondences between this set and the set B by brute force

Parameters:
B other set
A_corr indices of matched points from this set
B_corr indices of matched points from the set B
distances the distance between the correspondences is stored here
remove_duplicates if true, ambiguous matches are discarded
max_ratio max ratio between the two nearest neighbours
void DVision::SurfSet::CalculateFastCorrespondences ( const SurfSet B,
std::vector< int > &  A_corr,
std::vector< int > &  B_corr,
std::vector< double > *  distances = NULL,
bool  remove_duplicates = true,
double  max_ratio = 0.6 
)

Calculates correspondences between this set and the set B by using flann

Parameters:
B other set
A_corr indices of matched points from this set
B_corr indices of matched points from the set B
distances if given, the distance between the correspondences is stored here
remove_duplicates if true, ambiguous matches are discarded
max_ratio max ratio between the two nearest neighbours
double DVision::SurfSet::calculateSqDistance ( std::vector< float >::const_iterator  ita,
std::vector< float >::const_iterator  itb,
const int  L 
) const [protected]

Calculates the square distance between two descriptors

Parameters:
ita beginning of one descriptor
itb beginning of the other descriptor
L length of descriptor vectors
void SurfSet::compute ( const cv::Mat &  image,
const std::vector< cv::KeyPoint > &  keypoints,
const CvSURFParams &  params 
) [protected]

Performs the actual computation with the provided parameters

Parameters:
image 
keypoints keypoints to set
params surf detector parameters
See also:
SurfSet::Compute
void SurfSet::Compute ( const cv::Mat &  image,
const std::vector< cv::KeyPoint > &  keypoints,
bool  extended = false 
)

Copies the given keypoints and computes their SURF descriptors

Parameters:
image 
keypoints 
extended if true, 128-dimensional surf are used instead of 64-d
Note:
the laplacian vector cannot be computed, so it is filled with ones
bool DVision::SurfSet::empty (  )  const [inline]

Returns whether the key collection is empty

void SurfSet::extract ( const cv::Mat &  image,
const CvSURFParams &  params 
) [protected]

Performs the actual extraction with the provided parameters

Parameters:
image 
params surf detector params
See also:
SurfSet::Extract
void SurfSet::Extract ( const cv::Mat &  image,
double  hessianTh = 400.0,
bool  extended = false 
)

Extract surf points from an image

Parameters:
image 
hessianTh hessian threshold
extended if true, 128-dimensional surf are used instead of 64-d
std::vector< float > DVision::SurfSet::get ( unsigned int  i  )  const [inline]

Returns a copy of the i-th descriptor

Parameters:
i 
Returns:
i-th descriptor
int DVision::SurfSet::GetDescriptorLength (  )  const [inline]

Returns the length of the descriptor vectors of the SURF features or 0 if no features have been extracted yet

Returns:
descriptor vector length
int SurfSet::getPointOctave ( const CvSURFPoint &  kpt,
const CvSURFParams &  params 
) const [protected]

Returns the octave of a surf keypoint

Parameters:
kpt keypoint
params extractor parameters
Note:
This function is copied from the opencv surf.cpp file, written by Liu Liu
void SurfSet::load ( cv::FileStorage &  fs,
int  idx 
) [protected]

Loads the surfset from the given file storage The keys are created with the suffix idx

Parameters:
fs 
idx index of set to load
void SurfSet::Load ( const std::string &  filename  ) 

Loads the features from filename and removes the current ones

Parameters:
filename 
void SurfSet::LoadCustom ( const std::string &  filename  ) 

Loads the features from a custom file, removing the current ones

Parameters:
filename 
Note:
This function is DEPRECATED
void SurfSet::RecalculateApproximationTree (  ) 

Creates the flann index to compute approximate correspondences. This function is called automatically the first time when CalculateCorrespondences is invoked in the approximate mode

void SurfSet::Remove ( const std::vector< unsigned int > &  ids  ) 

Removes several poitns from the set preserving the order

Parameters:
ids indexes to remove
void SurfSet::Remove ( unsigned int  i  ) 

Removes a point from the set, preserving the order

Parameters:
i index to remove
void SurfSet::save ( cv::FileStorage &  fs,
int  idx 
) const [protected]

Saves the surfset in the given file storage The keys are created with the suffix idx

Parameters:
fs 
idx index given to the saved set
void SurfSet::Save ( const std::string &  filename  )  const

Saves the features into a file with a OpenCV writer

Parameters:
filename 
void SurfSet::SaveCustom ( const std::string &  filename  )  const

Saves the features into a file in a custom format

Parameters:
filename 
Note:
This function is DEPRECATED
The file format starts with 2 integers giving the total number of keypoints and the size of descriptor vector for each keypoint. Then each keypoint is specified by the following fields: x y angle size hessian octave laplacian_sign descriptor_vector
unsigned int DVision::SurfSet::size (  )  const [inline]

Returns the number of keypoints in the set


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations
Generated on Thu Feb 7 19:24:58 2013 by  doxygen 1.6.3