digiKam
Loading...
Searching...
No Matches
kd_treebase.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam
4 *
5 * Date : 2019-06-08
6 * Description : Implementation of KD-Tree for vector space partitioning.
7 *
8 * SPDX-FileCopyrightText: 2020 by Nghia Duong <minhnghiaduong997 at gmail dot com>
9 * SPDX-FileCopyrightText: 2024 by Michael Miller <michael underscore miller at msn dot com>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15#pragma once
16
17// C++ includes
18
19#include <vector>
20
21// Qt includes
22
23#include <QVector>
24#include <QMap>
25
26// Local include
27
28#include "digikam_opencv.h"
29#include "kd_nodebase.h"
30
38#define KDTREE_MAP_THRESHOLD 500
39
40namespace Digikam
41{
42
44{
45
46public:
47
48 explicit KDTreeBase(int dim, int kdtreeThreshold);
49 virtual ~KDTreeBase();
50
54 virtual QMap<double, QVector<int> > getClosestNeighbors(const cv::Mat& position,
55 float sqRange,
56 int maxNbNeighbors) const;
57
64 virtual KDNodeBase* add(const cv::Mat& position, const int identity);
65
74 virtual KDNodeBase* createNode(const cv::Mat& nodePos,
75 const int identity,
76 int splitAxis,
77 int dimension) = 0;
78
79private:
80
81 // Disable
82 KDTreeBase(const KDTreeBase&) = delete;
83 KDTreeBase& operator=(const KDTreeBase&) = delete;
84
85 virtual float getCosThreshold(float sqRange) const = 0;
86
87private:
88
89 class Private;
90 Private* const d = nullptr;
91};
92
93} // namespace Digikam
Definition kd_nodebase.h:34
Definition kd_treebase.h:44
virtual ~KDTreeBase()
Definition kd_treebase.cpp:77
virtual KDNodeBase * add(const cv::Mat &position, const int identity)
add new node to KD-Tree
Definition kd_treebase.cpp:82
virtual KDNodeBase * createNode(const cv::Mat &nodePos, const int identity, int splitAxis, int dimension)=0
create an ew node
virtual QMap< double, QVector< int > > getClosestNeighbors(const cv::Mat &position, float sqRange, int maxNbNeighbors) const
Definition kd_treebase.cpp:122
Definition datefolderview.cpp:34