Class MatchingProblem

Nested Relationships

Inheritance Relationships

Derived Type

Class Documentation

class aslam::MatchingProblem

Defines the specifics of a matching problem.

defines the specifics of a matching problem

The problem is assumed to have two visual frames (apple_frame and banana_frame) filled with keypoints and binary descriptors and a rotation matrix taking vectors from the banana frame into the apple frame. The problem matches banana features against apple features.

Coordinate Frames: A: apple frame B: banana frame

IMPORTANT NOTE: If you create a new matching problem inheriting from this class, make sure not to forget to add the ASLAM_ADD_MATCH_TYPEDEFS_WITH_ALIASES( NewMatchingProblemClassName, alias_for_getAppleIndex, alias_for_getBananaIndex) macro in the public class body! Otherwise, no matches type will be available for the new problem and compilation will fail.

The problem is assumed to have two lists (Apples and Bananas) whose elements can be referenced by a linear index. The problem defines the score and scoring function between two elements of the lists, and a method to get a short list of candidates from list Apples for elements of list Bananas.

The match is not necessarily symmetric. For example, Apples can represent a reference and Bananas queries.

Subclassed by aslam::MatchingProblemFrameToFrame

Public Types

typedef Aligned<std::vector, Candidate> Candidates
typedef Aligned<std::vector, Candidates> CandidatesList

Public Functions

MatchingProblem() = default
virtual ~MatchingProblem() = default
virtual size_t numApples() const = 0
virtual size_t numBananas() const = 0
inline virtual void getCandidates(CandidatesList *candidates_for_bananas)

Get a short list of candidates for all banana indices.

Return all indices of list a for n^2 matching; or use something smarter like nabo to get nearest neighbors. Can also be used to mask out invalid elements in the lists, or an invalid b, by returning and empty candidate list.

The score for each candidate is a rough score that can be used for sorting, pre-filtering, and will be explicitly recomputed using the computeScore function.


candidates_for_bananas[out] Candidates from the Apples-list that could potentially match for each banana.

inline virtual void getAppleCandidatesForBanana(int, Candidates*)

Get a short list of candidates for a given banana index.

  • banana_index[in] The index of the banana queried for candidates.

  • candidates_for_bananas[out] Candidates from the Apples-list that could potentially match for each element of Bananas.

virtual bool doSetup() = 0

Gets called at the beginning of the matching problem; i.e.

to setup kd-trees, lookup tables or the like.

Public Members

CandidatesList all_tested_pairs_

List of tested match pairs for every banana.

This is only retrieved and stored if the flag ‘matcher_store_all_tested_pairs’ is set to true.

struct Candidate

Public Functions

inline Candidate()
inline Candidate(int _index_apple, int _index_banana, double _score, int _priority)
inline bool operator<(const Candidate &other) const
inline bool operator>(const Candidate &other) const
inline bool operator==(const Candidate &other) const

Public Members

int index_apple
int index_banana
double score
int priority

The priority field allows categorizing candidates.

Certain matching engines might treat candidates differently according to their priority. The priority outrules the score in the candidate comparison.