Ocean
|
This class implements a Vocabulary Tree for feature descriptors. More...
Data Structures | |
class | ReusableData |
Definition of a class which holds reusable data for internal use. More... | |
Public Types | |
typedef TDescriptor | Descriptor |
The descriptor type of this tree. More... | |
typedef TDistance | Distance |
The distance data type of this tree. More... | |
typedef NextLargerTyper< TDistance >::TypePerformance | TSumDistances |
The data type of the sum of distances, uint64_t for uint32_t, and float for float. More... | |
typedef std::vector< TDescriptor > | TDescriptors |
Definition of a vector holding descriptors. More... | |
typedef std::vector< TDistance > | TDistances |
Definition of a vector holding distances. More... | |
typedef VocabularyTree< TDescriptor, TDistance, tDistanceFunction > | Node |
Definition of a tree node which is just an alias for the tree (the root node). More... | |
typedef std::vector< Node * > | Nodes |
Definition of a vector holding tree nodes. More... | |
typedef std::vector< const Node * > | ConstNodes |
Definition of a vector holding constant tree nodes. More... | |
using | Match = Match< TDistance > |
Definition of a Match object using the distance data type of this tree. More... | |
using | Matches = Matches< TDistance > |
Definition of a vector holding Match objects. More... | |
using | ClustersMeanFunction = TDescriptors(*)(const unsigned int numberClusters, const TDescriptor *treeDescriptors, const Index32 *descriptorIndices, const Index32 *clusterIndicesForDescriptors, const size_t numberDescriptorIndices, Worker *worker) |
Definition of a function pointer allowing to determine the mean descriptors for individual clusters. More... | |
template<typename TMultiDescriptor > | |
using | MultiDescriptorFunction = const TDescriptor *(*)(const TMultiDescriptor &, const size_t) |
Definition of a function pointer to a function allowing to return individual descriptors from a multi-descriptor. More... | |
template<typename TMultiDescriptorGroup , typename TMultiDescriptor > | |
using | MultiDescriptorGroupFunction = const TMultiDescriptor *(*)(const TMultiDescriptorGroup &, const size_t) |
Definition of a function pointer to a function allowing to return individual multi-descriptors from a group of multi-descriptors. More... | |
Public Types inherited from Ocean::Tracking::VocabularyStructure | |
enum | InitializationStrategy : uint32_t { IS_INVALID = 0u , IS_PURE_RANDOM , IS_LARGEST_DISTANCE } |
Definition of individual strategies to initialize the clustering of each tree node. More... | |
enum | MatchingMode : uint32_t { MM_INVALID = 0u , MM_FIRST_BEST_LEAF , MM_ALL_BEST_LEAFS , MM_ALL_GOOD_LEAFS_1 , MM_ALL_GOOD_LEAFS_2 } |
Definition of individual matching modes for descriptors. More... | |
template<typename TDistance > | |
using | Matches = std::vector< Match< TDistance > > |
Definition of a vector holding matches. More... | |
Public Member Functions | |
VocabularyTree ()=default | |
Creates an empty vocabulary tree. More... | |
VocabularyTree (VocabularyTree &&vocabularyTree) | |
Move constructor. More... | |
VocabularyTree (const TDescriptor *treeDescriptors, const size_t numberTreeDescriptors, const ClustersMeanFunction &clustersMeanFunction, const Parameters ¶meters=Parameters(), Worker *worker=nullptr, RandomGenerator *randomGenerator=nullptr) | |
Creates a new tree for a known descriptors. More... | |
~VocabularyTree () | |
Destructs the vocabulary tree. More... | |
const Indices32 & | determineBestLeaf (const TDescriptor &descriptor) const |
Determines the leaf best matching with a given descriptor. More... | |
void | determineBestLeafs (const TDescriptor &descriptor, std::vector< const Indices32 * > &leafs, const TDistance distanceEpsilon=TDistance(0)) const |
Determines the leafs best matching with a given descriptor. More... | |
template<MatchingMode tMatchingMode = MM_FIRST_BEST_LEAF> | |
Index32 | matchDescriptor (const TDescriptor *candidateDescriptors, const TDescriptor &queryDescriptor, TDistance *distance=nullptr, const ReusableData &reusableData=ReusableData()) const |
Matches a query descriptor with all candidate descriptors in this tree. More... | |
template<MatchingMode tMatchingMode = MM_FIRST_BEST_LEAF> | |
Index32 | matchMultiDescriptor (const TDescriptor *candidateDescriptors, const TDescriptor *queryMultiDescriptor, const size_t numberQuerySingleDescriptors, TDistance *distance=nullptr, const ReusableData &reusableData=ReusableData()) const |
Matches a query multi-descriptor with all candidate descriptors in this tree. More... | |
template<typename TMultiDescriptor , MultiDescriptorFunction< TMultiDescriptor > tMultiDescriptorFunction, MatchingMode tMatchingMode = MM_FIRST_BEST_LEAF> | |
Index32 | matchMultiDescriptor (const TDescriptor *candidateDescriptors, const TMultiDescriptor &queryMultiDescriptor, TDistance *distance=nullptr, const ReusableData &reusableData=ReusableData()) const |
Matches a query multi-descriptor with all candidate descriptors in this tree. More... | |
template<typename TMultiDescriptorGroup , typename TMultiDescriptor , MultiDescriptorGroupFunction< TMultiDescriptorGroup, TMultiDescriptor > tMultiDescriptorGroupFunction, MultiDescriptorFunction< TMultiDescriptor > tMultiDescriptorFunction, MatchingMode tMatchingMode = MM_FIRST_BEST_LEAF> | |
Index32 | matchMultiDescriptorGroup (const TDescriptor *candidateDescriptors, const TMultiDescriptorGroup &queryMultiDescriptorGroup, TDistance *distance=nullptr, const ReusableData &reusableData=ReusableData()) const |
Matches a query group of multi-descriptors with all candidate descriptors in this tree. More... | |
template<MatchingMode tMatchingMode = MM_FIRST_BEST_LEAF> | |
void | matchDescriptors (const TDescriptor *candidateDescriptors, const TDescriptor *queryDescriptors, const size_t numberQueryDescriptors, const TDistance maximalDistance, Matches &matches, Worker *worker=nullptr) const |
Matches several query descriptors with all candidate descriptors in this tree. More... | |
template<typename TMultiDescriptor , MultiDescriptorFunction< TMultiDescriptor > tMultiDescriptorFunction, MatchingMode tMatchingMode = MM_FIRST_BEST_LEAF> | |
void | matchMultiDescriptors (const TDescriptor *candidateDescriptors, const TMultiDescriptor *queryMultiDescriptors, const size_t numberQueryMultiDescriptors, const TDistance maximalDistance, Matches &matches, Worker *worker=nullptr) const |
Matches several query multi-descriptors with all candidate descriptors in this tree. More... | |
template<typename TMultiDescriptorGroup , typename TMultiDescriptor , MultiDescriptorGroupFunction< TMultiDescriptorGroup, TMultiDescriptor > tMultiDescriptorGroupFunction, MultiDescriptorFunction< TMultiDescriptor > tMultiDescriptorFunction, MatchingMode tMatchingMode = MM_FIRST_BEST_LEAF> | |
void | matchMultiDescriptorGroups (const TDescriptor *candidateDescriptors, const TMultiDescriptorGroup *queryMultiDescriptorGroups, const size_t numberQueryMultiDescriptorGroups, const TDistance maximalDistance, Matches &matches, Worker *worker=nullptr) const |
Matches several query groups of multi-descriptors with all candidate descriptors in this tree. More... | |
const TDescriptor & | nodeDescriptor () const |
Returns the descriptor representing this tree/node. More... | |
const Indices32 & | descriptorIndices () const |
Returns all indices of descriptors which belong to this tree/node. More... | |
const Nodes & | childNodes () const |
Returns all child nodes of this node/tree. More... | |
VocabularyTree & | operator= (VocabularyTree &&vocabularyTree) |
Move operator. More... | |
VocabularyTree & | operator= (const VocabularyTree &vocabularyTree)=delete |
Disabled assign operator. More... | |
Public Member Functions inherited from Ocean::Tracking::VocabularyStructure | |
virtual | ~VocabularyStructure ()=default |
Destructs this object. More... | |
Static Public Member Functions | |
template<unsigned int tSize> | |
static TDescriptors | determineClustersMeanForBinaryDescriptor (const unsigned int numberClusters, const TDescriptor *treeDescriptors, const Index32 *descriptorIndices, const Index32 *clusterIndicesForDescriptors, const size_t numberDescriptorIndices, Worker *worker) |
Determines a binary mean descriptor for each cluster. More... | |
template<unsigned int tSize> | |
static TDescriptors | determineClustersMeanForFloatDescriptor (const unsigned int numberClusters, const TDescriptor *treeDescriptors, const Index32 *descriptorIndices, const Index32 *clusterIndicesForDescriptors, const size_t numberDescriptorIndices, Worker *worker) |
Determines a float mean descriptor for each cluster. More... | |
Static Public Member Functions inherited from Ocean::Tracking::VocabularyStructure | |
static constexpr Index32 | invalidMatchIndex () |
Returns an invalid matching index. More... | |
Static Public Attributes | |
static constexpr TDistance(* | distanceFunction )(const TDescriptor &, const TDescriptor &) = tDistanceFunction |
The pointer to the function determining the distance between two descriptors of this tree. More... | |
Protected Member Functions | |
VocabularyTree (const VocabularyTree &vocabularyTree)=delete | |
Disabled copy constructor. More... | |
VocabularyTree (const unsigned int level, const TDescriptor &nodeDescriptor, const Parameters ¶meters, const TDescriptor *treeDescriptors, Index32 *reusableDescriptorIndicesInput, Index32 *reusableDescriptorIndicesOutput, const size_t numberDescriptorsIndices, RandomGenerator &randomGenerator, Index32 *reusableClusterIndicesForDescriptors, const ClustersMeanFunction &clustersMeanFunction, Worker *worker) | |
Creates a new intermediate tree node. More... | |
VocabularyTree (const unsigned int level, const TDescriptor &nodeDescriptor, Index32 *descriptorIndices, size_t numberDescriptorsIndices) | |
Creates a new leaf node. More... | |
void | createChildNodes (const unsigned int childNodeLevel, const Parameters ¶meters, const TDescriptor *treeDescriptors, const TDescriptor *clusterCenters, const unsigned int *clusterSizes, const size_t numberClusters, Index32 *reusableDescriptorIndicesInput, Index32 *reusableDescriptorIndicesOutput, const size_t numberDescriptorsIndices, RandomGenerator &randomGenerator, Index32 *reusableClusterIndicesForDescriptors, const ClustersMeanFunction &clustersMeanFunction, Worker *worker) |
Creates the new child nodes. More... | |
TDescriptors | clusterDescriptors (const Parameters ¶meters, const TDescriptor *treeDescriptors, Index32 *reusableDescriptorIndicesInput, Index32 *reusableDescriptorIndicesOutput, size_t numberDescriptorsIndices, RandomGenerator &randomGenerator, Index32 *clusterIndicesForDescriptors, const ClustersMeanFunction &clustersMeanFunction, Indices32 *clusterSizes=nullptr, Worker *worker=nullptr) |
Distributes several descriptors into individual clusters. More... | |
TDescriptors | initialClusters (const Parameters ¶meters, const TDescriptor *treeDescriptors, Index32 *reusableDescriptorIndicesInput, Index32 *reusableDescriptorIndicesOutput, size_t numberDescriptorsIndices, RandomGenerator &randomGenerator) |
Determines the initial clusters based on specified initialization strategy. More... | |
TDescriptors | initialClustersLargestDistance (const Parameters ¶meters, const TDescriptor *treeDescriptors, Index32 *descriptorIndices, Index32 *reusableIndices, const size_t numberDescriptorsIndices, RandomGenerator &randomGenerator) const |
Determines the initial clusters based on the largest distance between each other. More... | |
TDescriptors | initialClustersPureRandom (const Parameters ¶meters, const TDescriptor *treeDescriptors, Index32 *descriptorIndices, const size_t numberDescriptorsIndices, RandomGenerator &randomGenerator) const |
Determines the initial cluster based on a pure random choice. More... | |
void | createChildNodesSubset (const unsigned int childNodeLevel, const Parameters *parameters, const TDescriptor *treeDescriptors, const TDescriptor *clusterCenters, const unsigned int *clusterSizes, const size_t numberClusters, Index32 *reusableDescriptorIndicesInput, Index32 *reusableDescriptorIndicesOutput, const size_t numberDescriptorsIndices, RandomGenerator *randomGenerator, Index32 *reusableClusterIndicesForDescriptors, const ClustersMeanFunction *clustersMeanFunction, const unsigned int subsetFirstCluster, const unsigned int subsetNumberClusters) |
Creates a subset of the new child nodes. More... | |
template<MatchingMode tMatchingMode> | |
void | matchDescriptorsSubset (const TDescriptor *candidateDescriptors, const TDescriptor *queryDescriptors, const TDistance maximalDistance, Matches *matches, Lock *lock, const unsigned int firstQueryDescriptor, const unsigned int numberQueryDescriptors) const |
Matches a subset of several query descriptors with all tree candidate descriptors. More... | |
template<typename TMultiDescriptor , MultiDescriptorFunction< TMultiDescriptor > tMultiDescriptorFunction, MatchingMode tMatchingMode> | |
void | matchMultiDescriptorsSubset (const TDescriptor *candidateDescriptors, const TMultiDescriptor *queryMultiDescriptors, const TDistance maximalDistance, Matches *matches, Lock *lock, const unsigned int firstQueryMultiDescriptor, const unsigned int numberQueryMultiDescriptors) const |
Matches a subset of several query multi-descriptors with all tree candidate descriptors. More... | |
template<typename TMultiDescriptorGroup , typename TMultiDescriptor , MultiDescriptorGroupFunction< TMultiDescriptorGroup, TMultiDescriptor > tMultiDescriptorGroupFunction, MultiDescriptorFunction< TMultiDescriptor > tMultiDescriptorFunction, MatchingMode tMatchingMode> | |
void | matchMultiDescriptorGroupsSubset (const TDescriptor *candidateDescriptors, const TMultiDescriptorGroup *queryMultiDescriptorGroups, const TDistance maximalDistance, Matches *matches, Lock *lock, const unsigned int firstQueryMultiDescriptorGroup, const unsigned int numberQueryMultiDescriptorGroups) const |
Matches a subset of several query groups of multi-descriptors with all candidate descriptors in this tree. More... | |
Protected Member Functions inherited from Ocean::Tracking::VocabularyStructure | |
VocabularyStructure ()=default | |
Default constructor. More... | |
Static Protected Member Functions | |
static Indices32 | assignDescriptorsToClusters (const TDescriptor *clusterCenters, const unsigned int numberClusters, const TDescriptor *treeDescriptors, const Index32 *descriptorIndices, Index32 *clusterIndicesForDescriptors, const size_t numberDescriptorIndices, TSumDistances *sumDistances=nullptr, Worker *worker=nullptr) |
Assigns descriptors to clusters. More... | |
static void | assignDescriptorsToClustersSubset (const TDescriptor *clusterCenters, const unsigned int numberClusters, const TDescriptor *treeDescriptors, const Index32 *descriptorIndices, Index32 *clusterIndicesForDescriptors, Index32 *clusterSizes, TSumDistances *sumDistances, Lock *lock, const unsigned int firstDescriptorIndex, const unsigned int numberDescriptorIndices) |
Assigns a subset of descriptors to clusters. More... | |
Static Protected Member Functions inherited from Ocean::Tracking::VocabularyStructure | |
static std::vector< uint8_t > | generateBitSeparationLookup8 () |
Returns the lookup table which separates the bits of a byte into 8 individual bytes. More... | |
Protected Attributes | |
unsigned int | level_ = 0u |
The node's level. More... | |
TDescriptor | nodeDescriptor_ |
The node's descriptor. More... | |
Indices32 | descriptorIndices_ |
The indices of the descriptors which are part of this node. More... | |
Nodes | childNodes_ |
The child-nodes of this node. More... | |
This class implements a Vocabulary Tree for feature descriptors.
Trees will not own the memory of the provided descriptors.
Tree descriptors have to be provided as one memory array and trees store indices to these descriptors only.
The tree descriptors need to exist as long as the corresponding tree exists.
TDescriptor | The data type of the descriptors for which the tree will be created |
TDistance | The data type of the distance measure between two descriptors, e.g., 'unsigned int', 'float' |
tDistanceFunction | The pointers to the function able to calculate the distance between two descriptors |
using Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::ClustersMeanFunction = TDescriptors(*)(const unsigned int numberClusters, const TDescriptor* treeDescriptors, const Index32* descriptorIndices, const Index32* clusterIndicesForDescriptors, const size_t numberDescriptorIndices, Worker* worker) |
Definition of a function pointer allowing to determine the mean descriptors for individual clusters.
typedef std::vector<const Node*> Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::ConstNodes |
Definition of a vector holding constant tree nodes.
typedef TDescriptor Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::Descriptor |
The descriptor type of this tree.
typedef TDistance Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::Distance |
The distance data type of this tree.
using Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::Match = Match<TDistance> |
Definition of a Match object using the distance data type of this tree.
using Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::Matches = Matches<TDistance> |
Definition of a vector holding Match objects.
using Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::MultiDescriptorFunction = const TDescriptor*(*)(const TMultiDescriptor&, const size_t) |
Definition of a function pointer to a function allowing to return individual descriptors from a multi-descriptor.
A feature point can be described with a multi-descriptor if the feature point has been seen from individual distances (to be scale invariant to some extent). First function parameter is the multi-descriptor, second parameter is the index of the actual descriptor to return, returns nullptr if the index is out of range
using Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::MultiDescriptorGroupFunction = const TMultiDescriptor*(*)(const TMultiDescriptorGroup&, const size_t) |
Definition of a function pointer to a function allowing to return individual multi-descriptors from a group of multi-descriptors.
A feature point can be described with a group of multi-descriptors if the feature point has been seen from individual locations or at individual moments in time (e.g., day vs. night). First function parameter is the multi-descriptor group, second parameter is the index of the actual multi-descriptor to return, returns nullptr if the index is out of range
typedef VocabularyTree<TDescriptor, TDistance, tDistanceFunction> Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::Node |
Definition of a tree node which is just an alias for the tree (the root node).
typedef std::vector<Node*> Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::Nodes |
Definition of a vector holding tree nodes.
typedef std::vector<TDescriptor> Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::TDescriptors |
Definition of a vector holding descriptors.
typedef std::vector<TDistance> Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::TDistances |
Definition of a vector holding distances.
typedef NextLargerTyper<TDistance>::TypePerformance Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::TSumDistances |
The data type of the sum of distances, uint64_t for uint32_t, and float for float.
|
default |
Creates an empty vocabulary tree.
Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::VocabularyTree | ( | VocabularyTree< TDescriptor, TDistance, tDistanceFunction > && | vocabularyTree | ) |
Move constructor.
vocabularyTree | The vocabulary tree to be moved |
Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::VocabularyTree | ( | const TDescriptor * | treeDescriptors, |
const size_t | numberTreeDescriptors, | ||
const ClustersMeanFunction & | clustersMeanFunction, | ||
const Parameters & | parameters = Parameters() , |
||
Worker * | worker = nullptr , |
||
RandomGenerator * | randomGenerator = nullptr |
||
) |
Creates a new tree for a known descriptors.
The given descriptors must not change afterwards, the descriptors must exist as long as the tree exists.
treeDescriptors | The descriptors for which the new tree will be created, must be valid |
numberTreeDescriptors | The number of tree descriptors, with range [1, infinity) |
clustersMeanFunction | The function allowing to determine the mean descriptors for individual clusters, must be valid |
parameters | The parameters used to construct the tree, must be valid |
worker | Optional worker object to distribute the computation |
randomGenerator | Optional explicit random generator object |
Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::~VocabularyTree |
Destructs the vocabulary tree.
|
protecteddelete |
Disabled copy constructor.
vocabularyTree | The vocabulary tree to be copied |
|
protected |
Creates a new intermediate tree node.
level | The current node level, with range [0, infinity) |
nodeDescriptor | The descriptor of the new node |
parameters | The parameters used to construct the tree node, must be valid |
treeDescriptors | The descriptors of the entire tree from which some will be part of this new tree node, must be valid |
reusableDescriptorIndicesInput | The indices of the descriptors for which the new node will be created, must be valid |
reusableDescriptorIndicesOutput | Memory block of indices with same size as 'reusableDescriptorIndicesInput' which can be re-used internally, must be valid |
numberDescriptorsIndices | The number of given indices in 'reusableDescriptorIndicesInput', with range [1, infinity) |
randomGenerator | The random generator to be used |
reusableClusterIndicesForDescriptors | Memory block of indices with same size as 'reusableDescriptorIndicesInput' which can be reused internally, must be valid |
clustersMeanFunction | The function allowing to determine the mean descriptors for individual clusters, must be valid |
worker | Optional worker object to distribute the computation |
|
protected |
Creates a new leaf node.
level | The level of the leaf node, with range [0, infinity) |
nodeDescriptor | The descriptor of the leaf node |
descriptorIndices | The indices of the descriptors which represent the leaf node, must be valid |
numberDescriptorsIndices | The number of given descriptor indices, with range [1, infinity) |
|
staticprotected |
Assigns descriptors to clusters.
clusterCenters | The centers of the clusters to which the descriptors will be assigned, must be valid |
numberClusters | The number of clusters, with range [1, infinity) |
treeDescriptors | The descriptors of the entire tree from which some will belong to the new clusters, must be valid |
descriptorIndices | The indices of the descriptors which need to be assigned, must be valid |
clusterIndicesForDescriptors | The resulting cluster indices to which the descriptors have been assigned, must be valid |
numberDescriptorIndices | The number of given indices of descriptors which will be assigned to the clusters, with range [1, infinity) |
sumDistances | Optional resulting sum of distances between all assigned descriptors and their corresponding cluster centers, nullptr if not of interest |
worker | Optional worker to distribute the computation |
|
staticprotected |
Assigns a subset of descriptors to clusters.
clusterCenters | The centers of the clusters to which the descriptors will be assigned, must be valid |
numberClusters | The number of clusters, with range [1, infinity) |
treeDescriptors | The descriptors of the entire tree from which some will belong to the new clusters, must be valid |
descriptorIndices | The indices of the descriptors which need to be assigned, must be valid |
clusterIndicesForDescriptors | The resulting cluster indices to which the descriptors have been assigned, must be valid |
clusterSizes | The sizes of the individual clusters, one for each cluster, must be valid |
sumDistances | Optional resulting sum of distances between all assigned descriptors and their corresponding cluster centers, nullptr if not of interest |
lock | Optional lock when executed in multiple threads in parallel, nullptr otherwise |
firstDescriptorIndex | The first descriptor index to be handled, with range [0, infinity) |
numberDescriptorIndices | The number of descriptor indices to be handled, with range [1, infinity) |
|
inline |
Returns all child nodes of this node/tree.
|
protected |
Distributes several descriptors into individual clusters.
parameters | The parameters used to construct the tree, must be valid |
treeDescriptors | The descriptors of the entire tree from which some will be part of the clusters, must be valid |
reusableDescriptorIndicesInput | The indices of the descriptors for which the new clusters will be created, must be valid |
reusableDescriptorIndicesOutput | Memory block of indices with same size as 'reusableDescriptorIndicesInput' which can be re-used internally, must be valid |
numberDescriptorsIndices | The number of provided indices of the tree descriptors, with range [1, infinity) |
randomGenerator | The random generator to be used |
clusterIndicesForDescriptors | The resulting cluster indices to which the descriptors have been assigned, must be valid |
clustersMeanFunction | The function allowing to determine the mean descriptors for individual clusters, must be valid |
clusterSizes | Optional resulting sizes of the individual resulting clusters |
worker | Optional worker object to distribute the computation |
|
protected |
Creates the new child nodes.
childNodeLevel | The level of the child nodes, with range [1, infinity) |
parameters | The parameters used to construct the tree node, must be valid |
treeDescriptors | The descriptors of the entire tree from which some will be part of this new tree node, must be valid |
clusterCenters | The descriptors of the individual child nodes (the centers of the clusters, one for each child node, must be valid |
clusterSizes | The sizes of the individual clusters, one for each cluster, must be valid |
numberClusters | The number of clusters and thus the number of child nodes, with range [1, infinity) |
reusableDescriptorIndicesInput | The indices of the descriptors for which the new node will be created, must be valid |
reusableDescriptorIndicesOutput | Memory block of indices with same size as 'reusableDescriptorIndicesInput' which can be re-used internally, must be valid |
numberDescriptorsIndices | The number of given indices in 'reusableDescriptorIndicesInput', with range [1, infinity) |
randomGenerator | The random generator to be used |
reusableClusterIndicesForDescriptors | Memory block of indices with same size as 'reusableDescriptorIndicesInput' which can be reused internally, must be valid |
clustersMeanFunction | The function allowing to determine the mean descriptors for individual clusters, must be valid |
worker | Optional worker object to distribute the computation |
|
protected |
Creates a subset of the new child nodes.
childNodeLevel | The level of the child nodes, with range [1, infinity) |
parameters | The parameters used to construct the tree node, must be valid |
treeDescriptors | The descriptors of the entire tree from which some will be part of this new tree node, must be valid |
clusterCenters | The descriptors of the individual child nodes (the centers of the clusters, one for each child node, must be valid |
clusterSizes | The sizes of the individual clusters, one for each cluster, must be valid |
numberClusters | The number of clusters and thus the number of child nodes, with range [1, infinity) |
reusableDescriptorIndicesInput | The indices of the descriptors for which the new node will be created, must be valid |
reusableDescriptorIndicesOutput | Memory block of indices with same size as 'reusableDescriptorIndicesInput' which can be re-used internally, must be valid |
numberDescriptorsIndices | The number of given indices in 'reusableDescriptorIndicesInput', with range [1, infinity) |
randomGenerator | The random generator to be used |
reusableClusterIndicesForDescriptors | Memory block of indices with same size as 'reusableDescriptorIndicesInput' which can be reused internally, must be valid |
clustersMeanFunction | The function allowing to determine the mean descriptors for individual clusters, must be valid |
subsetFirstCluster | The index of the first cluster (the first child node) to be handled, with range [0, numberClusters - 1] |
subsetNumberClusters | The number of clusters (child nodes) to be handled, with range [1, numberClusters - subsetFirstCluster] |
|
inline |
Returns all indices of descriptors which belong to this tree/node.
const Indices32 & Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::determineBestLeaf | ( | const TDescriptor & | descriptor | ) | const |
Determines the leaf best matching with a given descriptor.
Actually this function returns the tree's descriptors within the leaf.
descriptor | The descriptor for which the best leaf will be determined |
void Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::determineBestLeafs | ( | const TDescriptor & | descriptor, |
std::vector< const Indices32 * > & | leafs, | ||
const TDistance | distanceEpsilon = TDistance(0) |
||
) | const |
Determines the leafs best matching with a given descriptor.
Actually this function returns the tree's descriptors within the leafs.
descriptor | The descriptor for which the best leafs will be determined |
leafs | The resulting groups of indices of the descriptors within the leafs, must be empty when calling |
distanceEpsilon | The epsilon distance between the currently best node and node candidates |
|
static |
Determines a binary mean descriptor for each cluster.
numberClusters | The number of clusters, with range [1, infinity) |
treeDescriptors | The descriptors of the entire tree from which some will be part of the clusters, must be valid |
descriptorIndices | The indices of the individual descriptors wrt. the given descriptors, must be valid |
clusterIndicesForDescriptors | The indices of the clusters to which each individual descriptor belongs (a lookup table with cluster indices), one for each descriptor |
numberDescriptorIndices | The number of provided descriptor indices (the number of descriptors which are part of all clusters), must be valid |
worker | Optional worker to distribute the computation |
tSize | The number of bits per binary descriptor |
|
static |
Determines a float mean descriptor for each cluster.
numberClusters | The number of clusters, with range [1, infinity) |
treeDescriptors | The descriptors of the entire tree from which some will be part of the clusters, must be valid |
descriptorIndices | The indices of the individual descriptors wrt. the given descriptors, must be valid |
clusterIndicesForDescriptors | The indices of the clusters to which each individual descriptor belongs (a lookup table with cluster indices), one for each descriptor |
numberDescriptorIndices | The number of provided descriptor indices (the number of descriptors which are part of all clusters), must be valid |
worker | Optional worker to distribute the computation |
tSize | The number of elements per float descriptor |
|
protected |
Determines the initial clusters based on specified initialization strategy.
parameters | The parameters used to construct the tree, must be valid |
treeDescriptors | The descriptors of the entire tree from which some will be part of the clusters, must be valid |
reusableDescriptorIndicesInput | The indices of the descriptors for which the new clusters will be created, must be valid |
reusableDescriptorIndicesOutput | Memory block of indices with same size as 'reusableDescriptorIndicesInput' which can be re-used internally, must be valid |
numberDescriptorsIndices | The number of provided indices of the tree descriptors, with range [1, infinity) |
randomGenerator | The random generator to be used |
|
protected |
Determines the initial clusters based on the largest distance between each other.
The first cluster is selected randomly, the following clusters are selected so that they have the largest distance to the existing clusters.
parameters | The parameters used to construct the tree, must be valid |
treeDescriptors | The descriptors of the entire tree from which some will be part of the clusters, must be valid |
descriptorIndices | The indices of the tree descriptors for which the new clusters will be determined, must be valid |
reusableIndices | Memory block of indices with same size as 'descsriptorIndices' which can be re-used internally, must be valid |
numberDescriptorsIndices | The number of provided indices of the tree descriptors, with range [1, infinity) |
randomGenerator | The random generator to be used |
|
protected |
Determines the initial cluster based on a pure random choice.
parameters | The parameters used to construct the tree, must be valid |
treeDescriptors | The descriptors of the entire tree from which some will be part of the clusters, must be valid |
descriptorIndices | The indices of the tree descriptors for which the new clusters will be determined, must be valid |
numberDescriptorsIndices | The number of provided indices of the tree descriptors, with range [1, infinity) |
randomGenerator | The random generator to be used |
Index32 Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::matchDescriptor | ( | const TDescriptor * | candidateDescriptors, |
const TDescriptor & | queryDescriptor, | ||
TDistance * | distance = nullptr , |
||
const ReusableData & | reusableData = ReusableData() |
||
) | const |
Matches a query descriptor with all candidate descriptors in this tree.
candidateDescriptors | The entire set of tree candidate descriptors which have been used to create the tree, from which the best matching descriptor will be determined, must be valid |
queryDescriptor | The query descriptor for which the best matching tree candidate descriptor will be determined |
distance | Optional resulting distance, nullptr if not of interest |
reusableData | An reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other |
tMatchingMode | The mode which is used for matching |
void Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::matchDescriptors | ( | const TDescriptor * | candidateDescriptors, |
const TDescriptor * | queryDescriptors, | ||
const size_t | numberQueryDescriptors, | ||
const TDistance | maximalDistance, | ||
Matches & | matches, | ||
Worker * | worker = nullptr |
||
) | const |
Matches several query descriptors with all candidate descriptors in this tree.
candidateDescriptors | The entire set of tree candidate descriptors which have been used to create the tree, from which the best matching descriptor will be determined, must be valid |
queryDescriptors | The query descriptors for which the best matching tree candidate descriptors will be determined, can be nullptr if 'numberQueryDescriptors == 0' |
numberQueryDescriptors | The number of given query descriptors, with range [0, infinity) |
maximalDistance | The maximal distance between two matching descriptors, with range [0, infinity) |
matches | The resulting matches |
worker | Optional worker object to distribute the computation |
tMatchingMode | The mode which is used for matching |
|
protected |
Matches a subset of several query descriptors with all tree candidate descriptors.
candidateDescriptors | The entire set of tree candidate descriptors which have been used to create the tree, from which the best matching descriptor will be determined, must be valid |
queryDescriptors | The query descriptors for which the best matching tree candidate descriptors will be determined, must be valid |
maximalDistance | The maximal distance between two matching descriptors, with range [0, infinity) |
matches | The resulting matches |
lock | Optional lock when executed in multiple threads in parallel, nullptr otherwise |
firstQueryDescriptor | The index of the first query descriptor to be handled, with range [0, infinity) |
numberQueryDescriptors | The number of query descriptors to be handled, with range [1, infinity) |
tMatchingMode | The mode which is used for matching |
Index32 Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::matchMultiDescriptor | ( | const TDescriptor * | candidateDescriptors, |
const TDescriptor * | queryMultiDescriptor, | ||
const size_t | numberQuerySingleDescriptors, | ||
TDistance * | distance = nullptr , |
||
const ReusableData & | reusableData = ReusableData() |
||
) | const |
Matches a query multi-descriptor with all candidate descriptors in this tree.
candidateDescriptors | The entire set of tree candidate descriptors which have been used to create the tree, from which the best matching descriptor will be determined, must be valid |
queryMultiDescriptor | The first single descriptor of the query multi-descriptor for which the best matching tree candidate descriptor will be determined |
numberQuerySingleDescriptors | The number of single descriptors within the multi-descriptor, with range [1, infinity) |
distance | Optional resulting distance, nullptr if not of interest |
reusableData | An reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other |
tMatchingMode | The mode which is used for matching |
Index32 Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::matchMultiDescriptor | ( | const TDescriptor * | candidateDescriptors, |
const TMultiDescriptor & | queryMultiDescriptor, | ||
TDistance * | distance = nullptr , |
||
const ReusableData & | reusableData = ReusableData() |
||
) | const |
Matches a query multi-descriptor with all candidate descriptors in this tree.
A feature point can be described with a multi-descriptor if the feature point has been seen from individual distances (to be scale invariant to some extent).
candidateDescriptors | The entire set of tree candidate descriptors which have been used to create the tree, from which the best matching descriptor will be determined, must be valid |
queryMultiDescriptor | The query multi-descriptor for which the best matching tree candidate descriptor will be determined |
distance | Optional resulting distance, nullptr if not of interest |
reusableData | An reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other |
TMultiDescriptor | The data type of the multi-descriptor |
tMultiDescriptorFunction | The function pointer to a static function allowing to access one single-descriptor of a multi-descriptor, must be valid |
tMatchingMode | The mode which is used for matching |
Index32 Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::matchMultiDescriptorGroup | ( | const TDescriptor * | candidateDescriptors, |
const TMultiDescriptorGroup & | queryMultiDescriptorGroup, | ||
TDistance * | distance = nullptr , |
||
const ReusableData & | reusableData = ReusableData() |
||
) | const |
Matches a query group of multi-descriptors with all candidate descriptors in this tree.
A feature point can be described with a group of multi-descriptors if the feature point has been seen from individual locations or at individual moments in time (e.g., day vs. night).
candidateDescriptors | The entire set of tree candidate descriptors which have been used to create the tree, from which the best matching descriptor will be determined, must be valid |
queryMultiDescriptorGroup | The query group of multi-descriptors (all representing one query feature) for which the best matching tree candidate descriptor will be determined |
distance | Optional resulting distance, nullptr if not of interest |
reusableData | An reusable object to speedup the search, should be located outside of the function call if several function calls are done after each other |
TMultiDescriptorGroup | The data type of the multi-descriptor group |
TMultiDescriptor | The data type of the multi-descriptor |
tMultiDescriptorGroupFunction | The function pointer to a static function allowing to access one multi-descriptor of a group of multi-descriptors, must be valid |
tMultiDescriptorFunction | The function pointer to a static function allowing to access one single-descriptor of a multi-descriptor, must be valid |
tMatchingMode | The mode which is used for matching |
void Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::matchMultiDescriptorGroups | ( | const TDescriptor * | candidateDescriptors, |
const TMultiDescriptorGroup * | queryMultiDescriptorGroups, | ||
const size_t | numberQueryMultiDescriptorGroups, | ||
const TDistance | maximalDistance, | ||
Matches & | matches, | ||
Worker * | worker = nullptr |
||
) | const |
Matches several query groups of multi-descriptors with all candidate descriptors in this tree.
candidateDescriptors | The entire set of tree candidate descriptors which have been used to create the tree, from which the best matching descriptor will be determined, must be valid |
queryMultiDescriptorGroups | The query groups of multi-descriptors for which the best matching tree candidate descriptors will be determined, can be nullptr if 'numberQueryMultiDescriptors == 0' |
numberQueryMultiDescriptorGroups | The number of given query groups of multi-descriptors, with range [0, infinity) |
maximalDistance | The maximal distance between two matching descriptors, with range [0, infinity) |
matches | The resulting matches |
worker | Optional worker object to distribute the computation |
TMultiDescriptorGroup | The data type of the multi-descriptor group |
TMultiDescriptor | The data type of the multi-descriptor |
tMultiDescriptorGroupFunction | The function pointer to a static function allowing to access one multi-descriptor of a group of multi-descriptors, must be valid |
tMultiDescriptorFunction | The function pointer to a static function allowing to access one single-descriptor of a multi-descriptor, must be valid |
tMatchingMode | The mode which is used for matching |
|
protected |
Matches a subset of several query groups of multi-descriptors with all candidate descriptors in this tree.
candidateDescriptors | The entire set of tree candidate descriptors which have been used to create the tree, from which the best matching descriptor will be determined, must be valid |
queryMultiDescriptorGroups | The query groups of multi-descriptors for which the best matching tree candidate descriptors will be determined, can be nullptr if 'numberQueryMultiDescriptors == 0' |
maximalDistance | The maximal distance between two matching descriptors, with range [0, infinity) |
matches | The resulting matches |
lock | Optional lock when executed in multiple threads in parallel, nullptr otherwise |
firstQueryMultiDescriptorGroup | The index of the first query group of multi-descriptors to be handled, with range [0, infinity) |
numberQueryMultiDescriptorGroups | The number of query groups of multi-descriptors to be handled, with range [1, infinity) |
TMultiDescriptorGroup | The data type of the multi-descriptor group |
TMultiDescriptor | The data type of the multi-descriptor |
tMultiDescriptorGroupFunction | The function pointer to a static function allowing to access one multi-descriptor of a group of multi-descriptors, must be valid |
tMultiDescriptorFunction | The function pointer to a static function allowing to access one single-descriptor of a multi-descriptor, must be valid |
tMatchingMode | The mode which is used for matching |
void Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::matchMultiDescriptors | ( | const TDescriptor * | candidateDescriptors, |
const TMultiDescriptor * | queryMultiDescriptors, | ||
const size_t | numberQueryMultiDescriptors, | ||
const TDistance | maximalDistance, | ||
Matches & | matches, | ||
Worker * | worker = nullptr |
||
) | const |
Matches several query multi-descriptors with all candidate descriptors in this tree.
candidateDescriptors | The entire set of tree candidate descriptors which have been used to create the tree, from which the best matching descriptor will be determined, must be valid |
queryMultiDescriptors | The query multi-descriptors for which the best matching tree candidate descriptors will be determined, can be nullptr if 'numberQueryMultiDescriptors == 0' |
numberQueryMultiDescriptors | The number of given query multi-descriptors, with range [0, infinity) |
maximalDistance | The maximal distance between two matching descriptors, with range [0, infinity) |
matches | The resulting matches |
worker | Optional worker object to distribute the computation |
TMultiDescriptor | The data type of a multi-descriptor |
tMultiDescriptorFunction | The function pointer to a static function allowing to access one single-descriptor of a multi-descriptor, must be valid |
tMatchingMode | The mode which is used for matching |
|
protected |
Matches a subset of several query multi-descriptors with all tree candidate descriptors.
candidateDescriptors | The entire set of tree candidate descriptors which have been used to create the tree, from which the best matching descriptor will be determined, must be valid |
queryMultiDescriptors | The query multi-descriptors for which the best matching tree candidate descriptors will be determined, must be valid |
maximalDistance | The maximal distance between two matching descriptors, with range [0, infinity) |
matches | The resulting matches |
lock | Optional lock when executed in multiple threads in parallel, nullptr otherwise |
firstQueryMultiDescriptor | The index of the first query multi-descriptor to be handled, with range [0, infinity) |
numberQueryMultiDescriptors | The number of query multi-descriptors to be handled, with range [1, infinity) |
TMultiDescriptor | The data type of a multi-descriptor |
tMultiDescriptorFunction | The function pointer to a static function allowing to access one single-descriptor of a multi-descriptor, must be valid |
tMatchingMode | The mode which is used for matching |
|
inline |
Returns the descriptor representing this tree/node.
|
delete |
Disabled assign operator.
vocabularyTree | The vocabulary tree to be copied |
VocabularyTree< TDescriptor, TDistance, tDistanceFunction > & Ocean::Tracking::VocabularyTree< TDescriptor, TDistance, tDistanceFunction >::operator= | ( | VocabularyTree< TDescriptor, TDistance, tDistanceFunction > && | vocabularyTree | ) |
Move operator.
vocabularyTree | The vocabulary tree to be moved |
|
protected |
The child-nodes of this node.
|
protected |
The indices of the descriptors which are part of this node.
|
staticconstexpr |
The pointer to the function determining the distance between two descriptors of this tree.
|
protected |
The node's level.
|
protected |
The node's descriptor.