DLoopDetector::TemplatedLoopDetector< TDescriptor, F > Class Template Reference

Generic Loop detector. More...

#include <TemplatedLoopDetector.h>

List of all members.

Classes

struct  Parameters
 Parameters to create a loop detector. More...
struct  tIsland
 Matching island. More...
struct  tTemporalWindow
 Temporal consistency window. More...

Public Member Functions

 TemplatedLoopDetector (const Parameters &params=Parameters())
 TemplatedLoopDetector (const TemplatedVocabulary< TDescriptor, F > &voc, const Parameters &params=Parameters())
 TemplatedLoopDetector (const TemplatedDatabase< TDescriptor, F > &db, const Parameters &params=Parameters())
template<class T >
 TemplatedLoopDetector (const T &db, const Parameters &params=Parameters())
virtual ~TemplatedLoopDetector (void)
const TemplatedDatabase
< TDescriptor, F > & 
getDatabase () const
const TemplatedVocabulary
< TDescriptor, F > & 
getVocabulary () const
template<class T >
void setDatabase (const T &db)
void setVocabulary (const TemplatedVocabulary< TDescriptor, F > &voc)
void allocate (int nentries, int nkeys=0)
bool detectLoop (const std::vector< cv::KeyPoint > &keys, const std::vector< TDescriptor > &descriptors, DetectionResult &match)
void clear ()

Protected Member Functions

void removeLowScores (QueryResults &q, double threshold) const
void computeIslands (QueryResults &q, vector< tIsland > &islands) const
double calculateIslandScore (const QueryResults &q, unsigned int i_first, unsigned int i_last) const
void updateTemporalWindow (const tIsland &matched_island, EntryId entry_id)
int getConsistentEntries () const
bool isGeometricallyConsistent_DI (EntryId old_entry, const std::vector< cv::KeyPoint > &keys, const std::vector< TDescriptor > &descriptors, const FeatureVector &curvec) const
bool isGeometricallyConsistent_Flann (EntryId old_entry, const std::vector< cv::KeyPoint > &keys, const std::vector< TDescriptor > &descriptors, cv::FlannBasedMatcher &flann_structure) const
void getFlannStructure (const std::vector< TDescriptor > &descriptors, cv::FlannBasedMatcher &flann_structure) const
bool isGeometricallyConsistent_Exhaustive (const std::vector< cv::KeyPoint > &old_keys, const std::vector< TDescriptor > &old_descriptors, const std::vector< cv::KeyPoint > &cur_keys, const std::vector< TDescriptor > &cur_descriptors) const
void getMatches_neighratio (const std::vector< TDescriptor > &A, const vector< unsigned int > &i_A, const vector< TDescriptor > &B, const vector< unsigned int > &i_B, vector< unsigned int > &i_match_A, vector< unsigned int > &i_match_B) const

Protected Attributes

TemplatedDatabase< TDescriptor,
F > * 
m_database
 Database.
vector< vector< cv::KeyPoint > > m_image_keys
 KeyPoints of images.
vector< vector< TDescriptor > > m_image_descriptors
 Descriptors of images.
BowVector m_last_bowvec
 Last bow vector added to database.
tTemporalWindow m_window
 Temporal consistency window.
Parameters m_params
 Parameters of loop detector.
DVision::FSolver m_fsolver
 To compute the fundamental matrix.

Detailed Description

template<class TDescriptor, class F>
class DLoopDetector::TemplatedLoopDetector< TDescriptor, F >

Generic Loop detector.

TDescriptor: class of descriptor F: class of descriptor functions


Constructor & Destructor Documentation

template<class TDescriptor , class F >
DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::TemplatedLoopDetector ( const Parameters params = Parameters()  )  [inline]

Empty constructor

template<class TDescriptor , class F >
DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::TemplatedLoopDetector ( const TemplatedVocabulary< TDescriptor, F > &  voc,
const Parameters params = Parameters() 
) [inline]

Creates a loop detector with the given parameters and with a BoW2 database with the given vocabulary

Parameters:
voc vocabulary
params loop detector parameters
template<class TDescriptor , class F >
DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::TemplatedLoopDetector ( const TemplatedDatabase< TDescriptor, F > &  db,
const Parameters params = Parameters() 
) [inline]

Creates a loop detector with a copy of the given database, but clearing its contents

Parameters:
db database to copy
params loop detector parameters
template<class TDescriptor , class F >
template<class T >
DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::TemplatedLoopDetector ( const T &  db,
const Parameters params = Parameters() 
) [inline]

Creates a loop detector with a copy of the given database, but clearing its contents

Parameters:
T class derived from TemplatedDatabase
db database to copy
params loop detector parameters
template<class TDescriptor , class F >
DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::~TemplatedLoopDetector ( void   )  [inline, virtual]

Destructor


Member Function Documentation

template<class TDescriptor , class F >
void DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::allocate ( int  nentries,
int  nkeys = 0 
) [inline]

Allocates some memory for the first entries

Parameters:
nentries number of expected entries
nkeys number of keypoints per image expected
template<class TDescriptor , class F >
double DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::calculateIslandScore ( const QueryResults &  q,
unsigned int  i_first,
unsigned int  i_last 
) const [inline, protected]

Returns the score of the island composed of the entries of q whose indices are in [i_first, i_last] (both included)

Parameters:
q 
i_first first index of q of the island
i_last last index of q of the island
Returns:
island score
template<class TDescriptor , class F >
void DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::clear (  )  [inline]

Resets the detector and clears the database, such that the next entry will be 0 again

template<class TDescriptor , class F >
void DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::computeIslands ( QueryResults &  q,
vector< tIsland > &  islands 
) const [inline, protected]

Returns the islands of the given matches in ascending order of entry ids

Parameters:
q 
islands (out) computed islands
template<class TDescriptor , class F >
bool DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::detectLoop ( const std::vector< cv::KeyPoint > &  keys,
const std::vector< TDescriptor > &  descriptors,
DetectionResult match 
) [inline]

Adds the given tuple <keys, descriptors, current_t> to the database and returns the match if any

Parameters:
keys keypoints of the image
descriptors descriptors associated to the given keypoints
match (out) match or failing information
Returns:
true iff there was match
template<class TDescriptor , class F >
int DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::getConsistentEntries (  )  const [inline, protected]

Returns the number of consistent islands in the temporal window

Returns:
number of temporal consistent islands
template<class TDescriptor , class F >
const TemplatedDatabase< TDescriptor, F > & DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::getDatabase (  )  const [inline]

Retrieves a reference to the database used by the loop detector

Returns:
const reference to database
template<class TDescriptor , class F >
void DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::getFlannStructure ( const std::vector< TDescriptor > &  descriptors,
cv::FlannBasedMatcher &  flann_structure 
) const [inline, protected]

Creates a flann structure from a set of descriptors to perform queries

Parameters:
descriptors 
flann_structure (out) flann matcher
template<class TDescriptor , class F >
void DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::getMatches_neighratio ( const std::vector< TDescriptor > &  A,
const vector< unsigned int > &  i_A,
const vector< TDescriptor > &  B,
const vector< unsigned int > &  i_B,
vector< unsigned int > &  i_match_A,
vector< unsigned int > &  i_match_B 
) const [protected]

Calculate the matches between the descriptors A[i_A] and the descriptors B[i_B]. Applies a left-right matching without neighbour ratio

Parameters:
A set A of descriptors
i_A only descriptors A[i_A] will be checked
B set B of descriptors
i_B only descriptors B[i_B] will be checked
i_match_A (out) indices of descriptors matched (s.t. A[i_match_A])
i_match_B (out) indices of descriptors matched (s.t. B[i_match_B])
template<class TDescriptor , class F >
const TemplatedVocabulary< TDescriptor, F > & DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::getVocabulary (  )  const [inline]

Retrieves a reference to the vocabulary used by the loop detector

Returns:
const reference to vocabulary
template<class TDescriptor , class F >
bool DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::isGeometricallyConsistent_DI ( EntryId  old_entry,
const std::vector< cv::KeyPoint > &  keys,
const std::vector< TDescriptor > &  descriptors,
const FeatureVector &  curvec 
) const [inline, protected]

Check if an old entry is geometrically consistent (by calculating a fundamental matrix) with the given set of keys and descriptors

Parameters:
old_entry entry id of the stored image to check
keys current keypoints
descriptors current descriptors associated to the given keypoints
curvec feature vector of the current entry
template<class TDescriptor , class F >
bool DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::isGeometricallyConsistent_Exhaustive ( const std::vector< cv::KeyPoint > &  old_keys,
const std::vector< TDescriptor > &  old_descriptors,
const std::vector< cv::KeyPoint > &  cur_keys,
const std::vector< TDescriptor > &  cur_descriptors 
) const [inline, protected]

Check if an old entry is geometrically consistent (by calculating a fundamental matrix from left-right correspondences) with the given set of keys and descriptors, without using the direct index

Parameters:
old_keys keys of old entry
old_descriptors descriptors of old keys
cur_keys keys of current entry
cur_descriptors descriptors of cur keys
template<class TDescriptor , class F >
bool DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::isGeometricallyConsistent_Flann ( EntryId  old_entry,
const std::vector< cv::KeyPoint > &  keys,
const std::vector< TDescriptor > &  descriptors,
cv::FlannBasedMatcher &  flann_structure 
) const [inline, protected]

Checks if an old entry is geometrically consistent (by using FLANN and computing an essential matrix by using the neighbour ratio 0.6) with the given set of keys and descriptors

Parameters:
old_entry entry id of the stored image to check
keys current keypoints
descriptors current descriptors
flann_structure flann structure with the descriptors of the current entry
template<class TDescriptor , class F >
void DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::removeLowScores ( QueryResults &  q,
double  threshold 
) const [inline, protected]

Removes from q those results whose score is lower than threshold (that should be alpha * ns_factor)

Parameters:
q results from query
threshold min value of the resting results
template<class TDescriptor , class F >
template<class T >
void DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::setDatabase ( const T &  db  )  [inline]

Sets the database to use. The contents of the database and the detector entries are cleared

Parameters:
T class derived from TemplatedDatabase
db database to copy
template<class TDescriptor , class F >
void DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::setVocabulary ( const TemplatedVocabulary< TDescriptor, F > &  voc  )  [inline]

Sets a new DBoW2 database created from the given vocabulary

Parameters:
voc vocabulary to copy
template<class TDescriptor , class F >
void DLoopDetector::TemplatedLoopDetector< TDescriptor, F >::updateTemporalWindow ( const tIsland matched_island,
EntryId  entry_id 
) [inline, protected]

Updates the temporal window by adding the given match <island, id>, such that the window will contain only those islands which are consistent

Parameters:
matched_island 
entry_id 

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Enumerator
Generated on Thu Feb 7 19:29:55 2013 by  doxygen 1.6.3