Package boofcv.alg.scene.vocabtree
Class HierarchicalVocabularyTree<Point>
java.lang.Object
boofcv.alg.scene.vocabtree.HierarchicalVocabularyTree<Point>
A hierarchical tree which discretizes an N-Dimensional space. Each region in each node is defined by
the set of points which have mean[i] as the closest mean. Once the region is known at a level the child
node in the tree can then be looked up and the process repeated until it's at leaf.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Node in the Vocabulary tree -
Field Summary
Modifier and TypeFieldDescriptionint
Number of children for each nodefinal PackedArray<Point>
Computes distance between two points.int
Maximum number of levels in the tree -
Constructor Summary
ConstructorDescriptionHierarchicalVocabularyTree
(PointDistance<Point> distanceFunction, PackedArray<Point> descriptions) -
Method Summary
Modifier and TypeMethodDescriptionint
Adds a new node to the graph and returns its indexvoid
Ensures it has a valid configurationint
Finds the depth for a node.void
reset()
Clears references to initial state but keeps allocated memoryint
Traverses the tree to find the leaf node for the provided point.void
Traverses every node in the graph (excluding the root) in a depth first manor.
-
Field Details
-
branchFactor
public int branchFactorNumber of children for each node -
maximumLevel
public int maximumLevelMaximum number of levels in the tree -
distanceFunction
Computes distance between two points. Together with the 'mean' points, this defines the sub-regions -
descriptions
-
nodes
-
-
Constructor Details
-
HierarchicalVocabularyTree
public HierarchicalVocabularyTree(PointDistance<Point> distanceFunction, PackedArray<Point> descriptions)
-
-
Method Details
-
addNode
Adds a new node to the graph and returns its index- Parameters:
parentIndex
- Index of parent node.branch
- Which branch off the parent does it map to.desc
- The mean/description for this region- Returns:
- Index of the newly added node
-
searchPathToLeaf
public int searchPathToLeaf(Point point, BoofLambdas.ProcessIndex<HierarchicalVocabularyTree.Node> op) Traverses the tree to find the leaf node for the provided point. As it traverses the tree each node it passes through is passed to 'op'. Index of the leaf node is returned. The root node is not passed in since all points belong to it.- Parameters:
point
- (Input) Pointop
- Traversed nodes are passed to this function from level 0 to the leaf- Returns:
- index of the leaf node
-
traverseGraphDepthFirst
Traverses every node in the graph (excluding the root) in a depth first manor.- Parameters:
op
- Every node is feed into this function
-
depthOfNode
Finds the depth for a node. The depth is the number of hops away it is from the root node -
checkConfig
public void checkConfig()Ensures it has a valid configuration -
reset
public void reset()Clears references to initial state but keeps allocated memory
-