Collection of surf keypoints + descriptors. More...
#include <SurfSet.h>
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 ¶ms) |
void | compute (const cv::Mat &image, const std::vector< cv::KeyPoint > &keypoints, const CvSURFParams ¶ms) |
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 ¶ms) const |
Protected Attributes | |
cv::flann::Index * | m_index |
Flann index. | |
Friends | |
class | Matches |
Collection of surf keypoints + descriptors.
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
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
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
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
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
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
image | ||
keypoints | keypoints to set | |
params | surf detector parameters |
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
image | ||
keypoints | ||
extended | if true, 128-dimensional surf are used instead of 64-d |
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
image | ||
params | surf detector params |
void SurfSet::Extract | ( | const cv::Mat & | image, | |
double | hessianTh = 400.0 , |
|||
bool | extended = false | |||
) |
Extract surf points from an image
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
i |
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
int SurfSet::getPointOctave | ( | const CvSURFPoint & | kpt, | |
const CvSURFParams & | params | |||
) | const [protected] |
Returns the octave of a surf keypoint
kpt | keypoint | |
params | extractor parameters |
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
fs | ||
idx | index of set to load |
void SurfSet::Load | ( | const std::string & | filename | ) |
Loads the features from filename and removes the current ones
filename |
void SurfSet::LoadCustom | ( | const std::string & | filename | ) |
Loads the features from a custom file, removing the current ones
filename |
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
ids | indexes to remove |
void SurfSet::Remove | ( | unsigned int | i | ) |
Removes a point from the set, preserving the order
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
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
filename |
void SurfSet::SaveCustom | ( | const std::string & | filename | ) | const |
Saves the features into a file in a custom format
filename |
unsigned int DVision::SurfSet::size | ( | ) | const [inline] |
Returns the number of keypoints in the set