Class implementing k-D Tree data structure.
More...
#include <KDTree.h>
Class implementing k-D Tree data structure.
This class implementats a non-uniform k-D Tree data structure.
- Author
- Sergey G. Kosov, serge.nosp@m.y.ko.nosp@m.sov@p.nosp@m.roje.nosp@m.ct-10.nosp@m..de
Definition at line 17 of file KDTree.h.
◆ CKDTree() [1/3]
DirectGraphicalModels::CKDTree::CKDTree |
( |
void |
| ) |
|
|
inline |
Default constructor.
Definition at line 23 of file KDTree.h.
◆ CKDTree() [2/3]
DirectGraphicalModels::CKDTree::CKDTree |
( |
Mat & |
keys, |
|
|
Mat & |
values |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
keys | The tree keys: k-d points: Mat(size: nKeys x k; type: CV_8UC1) |
values | The values for every key: Mat(size: nKeys x 1; type: CV_8UC1) |
Definition at line 29 of file KDTree.h.
◆ CKDTree() [3/3]
DirectGraphicalModels::CKDTree::CKDTree |
( |
const CKDTree & |
| ) |
|
|
delete |
◆ ~CKDTree()
DirectGraphicalModels::CKDTree::~CKDTree |
( |
void |
| ) |
|
|
inline |
◆ build()
void DirectGraphicalModels::CKDTree::build |
( |
Mat & |
keys, |
|
|
Mat & |
values |
|
) |
| |
Builds a k-d tree on keys with corresponding values.
- Parameters
-
keys | The tree keys: k-d points: Mat(size: nKeys x k; type: CV_8UC1)
The keys matrix is modified by this function
|
values | The values for every key: Mat(size: nKeys x 1; type: CV_8UC1) |
Definition at line 90 of file KDTree.cpp.
◆ buildTree()
std::shared_ptr< CKDNode > DirectGraphicalModels::CKDTree::buildTree |
( |
Mat & |
data, |
|
|
pair_mat_t & |
boundingBox |
|
) |
| |
|
private |
◆ findNearestNeighbor()
std::shared_ptr<const CKDNode> DirectGraphicalModels::CKDTree::findNearestNeighbor |
( |
const Mat & |
key | ) |
const |
|
inline |
Finds the nearest neighbor to the key.
- Parameters
-
key | The search key: k-d point: Mat(size: 1 x k; type: CV_8UC1) |
- Returns
- The Node (tree leaf) with the key, which is the most close to the argument key
Definition at line 61 of file KDTree.h.
◆ findNearestNeighbors()
std::vector< std::shared_ptr< const CKDNode > > DirectGraphicalModels::CKDTree::findNearestNeighbors |
( |
const Mat & |
key, |
|
|
size_t |
maxNeighbors |
|
) |
| const |
Finds up to maxNeighbors nearest neighbors to the key.
- Parameters
-
key | The search key: k-d point: Mat(size: 1 x k; type: CV_8UC1) |
maxNeighbors | maximum number of neighbor nodes to find |
- Returns
- The array of Nodes (tree leaves) with the keys, which are the most close to the argument key
Definition at line 117 of file KDTree.cpp.
◆ findNearestNode()
std::shared_ptr< const CKDNode > DirectGraphicalModels::CKDTree::findNearestNode |
( |
const Mat & |
key | ) |
const |
|
private |
◆ getRoot()
std::shared_ptr<const CKDNode> DirectGraphicalModels::CKDTree::getRoot |
( |
void |
| ) |
const |
|
inline |
Returns pointer to the root of the tree.
- Returns
- The pointer to the root of the tree
Definition at line 73 of file KDTree.h.
◆ load()
void DirectGraphicalModels::CKDTree::load |
( |
const std::string & |
fileName | ) |
|
Loads a tree from the file.
- Parameters
-
fileName | The output file name |
Definition at line 80 of file KDTree.cpp.
◆ loadTree()
std::shared_ptr< CKDNode > DirectGraphicalModels::CKDTree::loadTree |
( |
FILE * |
pFile, |
|
|
int |
k |
|
) |
| |
|
private |
◆ operator=()
bool DirectGraphicalModels::CKDTree::operator= |
( |
const CKDTree |
| ) |
|
|
delete |
◆ reset()
void DirectGraphicalModels::CKDTree::reset |
( |
void |
| ) |
|
|
inline |
Resets the tree.
Definition at line 38 of file KDTree.h.
◆ save()
void DirectGraphicalModels::CKDTree::save |
( |
const std::string & |
fileName | ) |
const |
Saves the tree into a file.
- Parameters
-
fileName | The output file name |
Definition at line 65 of file KDTree.cpp.
◆ m_root
std::shared_ptr<CKDNode> DirectGraphicalModels::CKDTree::m_root |
|
private |
The documentation for this class was generated from the following files: