43 DllExport
void save(
const std::string &fileName)
const;
48 DllExport
void load(
const std::string &fileName);
55 DllExport
void build(Mat &keys, Mat &values);
68 DllExport std::vector<std::shared_ptr<const CKDNode>>
findNearestNeighbors(
const Mat &key,
size_t maxNeighbors)
const;
73 DllExport std::shared_ptr<const CKDNode>
getRoot(
void)
const {
return m_root; }
77 std::shared_ptr<CKDNode>
loadTree(FILE *pFile,
int k);
78 std::shared_ptr<CKDNode>
buildTree(Mat &data, pair_mat_t &boundingBox);
bool operator=(const CKDTree)=delete
std::shared_ptr< const CKDNode > findNearestNeighbor(const Mat &key) const
Finds the nearest neighbor to the key.
std::shared_ptr< const CKDNode > findNearestNode(const Mat &key) const
std::shared_ptr< CKDNode > buildTree(Mat &data, pair_mat_t &boundingBox)
std::shared_ptr< CKDNode > loadTree(FILE *pFile, int k)
Class implementing k-D Tree data structure.
std::shared_ptr< CKDNode > m_root
std::shared_ptr< const CKDNode > getRoot(void) const
Returns pointer to the root of the tree.
void build(Mat &keys, Mat &values)
Builds a k-d tree on keys with corresponding values.
void reset(void)
Resets the tree.
std::vector< std::shared_ptr< const CKDNode > > findNearestNeighbors(const Mat &key, size_t maxNeighbors) const
Finds up to maxNeighbors nearest neighbors to the key.
CKDTree(void)
Default constructor.
void load(const std::string &fileName)
Loads a tree from the file.
void save(const std::string &fileName) const
Saves the tree into a file.
CKDTree(Mat &keys, Mat &values)
Constructor.