OKVIS
|
This class matches keypoints from two frames in parallel. More...
#include <DenseMatcher.hpp>
Classes | |
struct | MatchJob |
A data struct for the worker thread. More... | |
struct | Pairing |
A struct to save an index and distance pair. More... | |
Public Types | |
typedef std::shared_ptr < DenseMatcher > | Ptr |
typedef float | distance_t |
typedef DenseMatcher::Pairing | pairing_t |
typedef std::vector< pairing_t > | pairing_list_t |
Public Member Functions | |
DenseMatcher (unsigned char numMatcherThreads=8, unsigned char numBest=4, bool useDistanceRatioThreshold=false) | |
Initialize the dense matcher. More... | |
virtual | ~DenseMatcher () |
template<typename MATCHING_ALGORITHM_T > | |
void | match (MATCHING_ALGORITHM_T &matchingAlgorithm) |
Execute a matching algorithm. This is the fast, templated version. Use this. More... | |
template<typename MATCHING_ALGORITHM_T > | |
void | matchInImageSpace (MATCHING_ALGORITHM_T &matchingAlgorithm) |
Execute a matching algorithm implementing image space matching (i.e. match landmarks with features in their image space vicinity) separate matching function for backwards compatability note: once a uniform implementation for the "old" matcher and the image space matching has been implemented these two methods (match, matchInImageSpace) may be merged into one. More... | |
void | matchSlow (MatchingAlgorithm &matchingAlgorithm) |
Execute a matching algorithm. This is the slow, runtime polymorphic version. Don't use this. More... | |
template<typename MATCHING_ALGORITHM_T > | |
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. More... | |
template<typename MATCHING_ALGORITHM_T > | |
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. More... | |
template<typename MATCHING_ALGORITHM_T > | |
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 best match. (From matchingAlgorithm->getListBStartIterator() to MatchingAlgorithm->getListBEndIterator(). More... | |
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. More... | |
template<typename MATCHING_ALGORITHM_T > | |
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_ found so far, it is included in the aiBest list. More... | |
Public Attributes | |
unsigned char | numMatcherThreads_ |
The set number of threads. More... | |
unsigned char | numBest_ |
The set number of best pairings to save. More... | |
bool | useDistanceRatioThreshold_ |
Use ratio of best and second best match instead of absolute threshold. More... | |
std::unique_ptr < okvis::ThreadPool > | matcherThreadPool_ |
The threads. More... | |
This class matches keypoints from two frames in parallel.
typedef float okvis::DenseMatcher::distance_t |
typedef std::vector<pairing_t> okvis::DenseMatcher::pairing_list_t |
typedef std::shared_ptr<DenseMatcher> okvis::DenseMatcher::Ptr |
okvis::DenseMatcher::DenseMatcher | ( | unsigned char | numMatcherThreads = 8 , |
unsigned char | numBest = 4 , |
||
bool | useDistanceRatioThreshold = false |
||
) |
Initialize the dense matcher.
numMatcherThreads | Number of matcher threads. |
numBest | The number of best matches to keep. |
useDistanceRatioThreshold | Instead of using an absolute descriptor distance threshold, compare the smallest distance to the second smallest to decide whether to set it as a match. |
|
virtual |
void okvis::DenseMatcher::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.
[in] | myIndexScored | The keypoint index that was scored with other keypoints. |
[in,out] | vPairsWithScore | The distances to other keypoints that a single thread calculated. |
[in,out] | aiBestList | The best matches so far. |
locks | The mutexes. | |
startidx | Start the assigning at some index. Used for the recursion. Set to 0. |
void okvis::DenseMatcher::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 best match. (From matchingAlgorithm->getListBStartIterator() to MatchingAlgorithm->getListBEndIterator().
MATCHING_ALGORITHM_T | The algorithm to use. E.g. a class derived from MatchingAlgorithm. |
my_job | Struct with information about the job. |
matchingAlgorithm | The matching algorithm to use. |
void okvis::DenseMatcher::doWorkLinearMatching | ( | MatchJob & | my_job, |
MATCHING_ALGORITHM_T * | matchingAlgorithm | ||
) |
The threading worker. This matches a keypoint with every other keypoint to find the best match.
MATCHING_ALGORITHM_T | The algorithm to use. E.g. a class derived from MatchingAlgorithm. |
my_job | Struct with information about the job. |
matchingAlgorithm | The matching algorithm to use. |
|
inline |
This calculates the distance between to keypoint descriptors. If it is better than the /e numBest_ found so far, it is included in the aiBest list.
MATCHING_ALGORITHM_T | The algorithm to use. E.g. a class derived from MatchingAlgorithm. |
matchingAlgorithm | The matching algorithm to use. | |
[in,out] | aiBest | The numBest_ pairings found so far. |
[in] | shortindexA | Keypoint index in frame A. |
[in] | i | Keypoint index in frame B. |
void okvis::DenseMatcher::match | ( | MATCHING_ALGORITHM_T & | matchingAlgorithm | ) |
Execute a matching algorithm. This is the fast, templated version. Use this.
MATCHING_ALGORITHM_T | The algorithm to use. E.g. a class derived from MatchingAlgorithm |
void okvis::DenseMatcher::matchBody | ( | void(DenseMatcher::*)(MatchJob &, MATCHING_ALGORITHM_T *) | doWorkPtr, |
MATCHING_ALGORITHM_T & | matchingAlgorithm | ||
) |
This function creates all the matching threads and assigns the best matches afterwards.
MATCHING_ALGORITHM_T | The algorithm to use. E.g. a class derived from MatchingAlgorithm |
doWorkPtr | The function that the threads are going to run. |
matchingAlgorithm | The matching algorithm. |
void okvis::DenseMatcher::matchInImageSpace | ( | MATCHING_ALGORITHM_T & | matchingAlgorithm | ) |
Execute a matching algorithm implementing image space matching (i.e. match landmarks with features in their image space vicinity) separate matching function for backwards compatability note: once a uniform implementation for the "old" matcher and the image space matching has been implemented these two methods (match, matchInImageSpace) may be merged into one.
void okvis::DenseMatcher::matchSlow | ( | MatchingAlgorithm & | matchingAlgorithm | ) |
Execute a matching algorithm. This is the slow, runtime polymorphic version. Don't use this.
std::unique_ptr<okvis::ThreadPool> okvis::DenseMatcher::matcherThreadPool_ |
The threads.
unsigned char okvis::DenseMatcher::numBest_ |
The set number of best pairings to save.
unsigned char okvis::DenseMatcher::numMatcherThreads_ |
The set number of threads.
bool okvis::DenseMatcher::useDistanceRatioThreshold_ |
Use ratio of best and second best match instead of absolute threshold.