41 #ifndef INCLUDE_OKVIS_DENSEMATCHER_HPP_
42 #define INCLUDE_OKVIS_DENSEMATCHER_HPP_
71 DenseMatcher(
unsigned char numMatcherThreads = 8,
unsigned char numBest = 4,
72 bool useDistanceRatioThreshold = false);
78 template<typename MATCHING_ALGORITHM_T>
79 void match(MATCHING_ALGORITHM_T & matchingAlgorithm);
86 template<typename MATCHING_ALGORITHM_T>
99 distance(std::numeric_limits<float>::max()) {
104 distance(std::numeric_limits<float>::max()) {
134 std::vector<std::vector<pairing_t> > *
vMyBest;
152 template<
typename MATCHING_ALGORITHM_T>
155 MATCHING_ALGORITHM_T& matchingAlgorithm);
163 template<
typename MATCHING_ALGORITHM_T>
165 MATCHING_ALGORITHM_T* matchingAlgorithm);
177 template<
typename MATCHING_ALGORITHM_T>
179 MATCHING_ALGORITHM_T* matchingAlgorithm);
190 std::vector<std::vector<pairing_t> > & aiBestList,
191 std::mutex* locks,
int startidx);
202 template<
typename MATCHING_ALGORITHM_T>
203 inline void listBIteration(MATCHING_ALGORITHM_T* matchingAlgorithm,
204 std::vector<pairing_t>& aiBest,
size_t shortindexA,
unsigned char numBest_
The set number of best pairings to save.
Definition: DenseMatcher.hpp:208
void doWorkLinearMatching(MatchJob &my_job, MATCHING_ALGORITHM_T *matchingAlgorithm)
The threading worker. This matches a keypoint with every other keypoint to find the best match...
Definition: DenseMatcher.hpp:183
A struct to save an index and distance pair.
Definition: DenseMatcher.hpp:95
std::vector< std::vector< pairing_t > > * vMyBest
The list of best matches so far.
Definition: DenseMatcher.hpp:134
Header file for the MatchingAlgorithm class.
std::unique_ptr< okvis::ThreadPool > matcherThreadPool_
The threads.
Definition: DenseMatcher.hpp:211
void match(MATCHING_ALGORITHM_T &matchingAlgorithm)
Execute a matching algorithm. This is the fast, templated version. Use this.
Definition: DenseMatcher.hpp:129
an interface for 1-1 matching between lists of things.
Definition: MatchingAlgorithm.hpp:66
void assignbest(int myIndexScored, pairing_list_t &vPairsWithScore, std::vector< std::vector< pairing_t > > &aiBestList, std::mutex *locks, int startidx)
A recursive function that reassigns weak matches, if a stronger match is found for a particular point...
Definition: DenseMatcher.cpp:69
DenseMatcher::pairing_t pairing_t
Definition: DenseMatcher.hpp:130
std::mutex * mutexes
Mutexes for read/write synchronization in assignment of best match.
Definition: DenseMatcher.hpp:143
DenseMatcher::Pairing pairing_t
Definition: DenseMatcher.hpp:121
float distance_t
Definition: DenseMatcher.hpp:92
unsigned char numMatcherThreads_
The set number of threads.
Definition: DenseMatcher.hpp:207
bool useDistanceRatioThreshold_
Use ratio of best and second best match instead of absolute threshold.
Definition: DenseMatcher.hpp:209
A data struct for the worker thread.
Definition: DenseMatcher.hpp:127
void matchInImageSpace(MATCHING_ALGORITHM_T &matchingAlgorithm)
Execute a matching algorithm implementing image space matching (i.e. match landmarks with features in...
Definition: DenseMatcher.hpp:140
#define OKVIS_DEFINE_EXCEPTION(exceptionName, exceptionParent)
Macro for defining an exception with a given parent.
Definition: assert_macros.hpp:52
This file contains some useful assert macros.
distance_t distance
Distance to paired keypoint.
Definition: DenseMatcher.hpp:118
int iThreadID
The thread ID of this job.
Definition: DenseMatcher.hpp:137
std::vector< pairing_t > pairing_list_t
Definition: DenseMatcher.hpp:122
std::vector< pairing_t > pairing_list_t
Definition: DenseMatcher.hpp:131
int indexA
Index of paired keypoint.
Definition: DenseMatcher.hpp:117
This class matches keypoints from two frames in parallel.
Definition: DenseMatcher.hpp:59
Pairing(int ia)
Constructor with maximum distance.
Definition: DenseMatcher.hpp:102
bool operator<(const Pairing &rhs) const
Compares distances.
Definition: DenseMatcher.hpp:113
DenseMatcher::pairing_list_t * vpairs
The list of pairs for this thread.
Definition: DenseMatcher.hpp:140
void doWorkImageSpaceMatching(MatchJob &my_job, MATCHING_ALGORITHM_T *matchingAlgorithm)
The threading worker. This matches a keypoint with only a subset of the other keypoints to find the b...
Definition: DenseMatcher.hpp:231
void matchBody(void(DenseMatcher::*doWorkPtr)(MatchJob &, MATCHING_ALGORITHM_T *), MATCHING_ALGORITHM_T &matchingAlgorithm)
This function creates all the matching threads and assigns the best matches afterwards.
Definition: DenseMatcher.hpp:48
Header implementation file for the DenseMatcher class.
void matchSlow(MatchingAlgorithm &matchingAlgorithm)
Execute a matching algorithm. This is the slow, runtime polymorphic version. Don't use this...
Definition: DenseMatcher.cpp:62
Pairing()
Default constructor.
Definition: DenseMatcher.hpp:97
void listBIteration(MATCHING_ALGORITHM_T *matchingAlgorithm, std::vector< pairing_t > &aiBest, size_t shortindexA, size_t i)
This calculates the distance between to keypoint descriptors. If it is better than the /e numBest_ fo...
Definition: DenseMatcher.hpp:153
std::shared_ptr< DenseMatcher > Ptr
Definition: DenseMatcher.hpp:62
Pairing(int ia, distance_t d)
Constructor.
Definition: DenseMatcher.hpp:107
Header file for the ThreadPool class.