digiKam
Loading...
Searching...
No Matches
Digikam::KDTreeBase Class Referenceabstract

#include <kd_treebase.h>

+ Inheritance diagram for Digikam::KDTreeBase:

Public Member Functions

virtual KDNodeBaseadd (const cv::Mat &position, const int identity)
 add new node to KD-Tree
 
virtual KDNodeBasecreateNode (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
 
 KDTreeBase (int dim, int kdtreeThreshold)
 
virtual ~KDTreeBase ()
 

Constructor & Destructor Documentation

◆ KDTreeBase()

Digikam::KDTreeBase::KDTreeBase ( int  dim,
int  threshold = KDTREE_MAP_THRESHOLD 
)
explicit

Using this to compare brute force vs kdtree performance due to sparse data in k-dimensions (128 dimensions for face features).

Parameters
thresholdIf the vector grows to 500 items, start using the KDTree.

◆ ~KDTreeBase()

Digikam::KDTreeBase::~KDTreeBase ( )
virtual

Member Function Documentation

◆ add()

KDNodeBase * Digikam::KDTreeBase::add ( const cv::Mat &  position,
const int  identity 
)
virtual

add new node to KD-Tree

Parameters
position: K-dimension vector
identity: identity of this face vector
Returns

References createNode().

Referenced by Digikam::FaceDb::reconstructTree(), and Digikam::OpenCVDNNFaceRecognizer::registerTrainingData().

◆ createNode()

virtual KDNodeBase * Digikam::KDTreeBase::createNode ( const cv::Mat &  nodePos,
const int  identity,
int  splitAxis,
int  dimension 
)
pure virtual

create an ew node

Parameters
nodePos: extracted face vectors
identity: identity of this face vector
splitAxis: current axis/dimension of the vector
dimension: number of dimensions (usually 128)
Returns
: KDNodeBase pointer

Referenced by add().

◆ getClosestNeighbors()

QMap< double, QVector< int > > Digikam::KDTreeBase::getClosestNeighbors ( const cv::Mat &  position,
float  sqRange,
int  maxNbNeighbors 
) const
virtual
Returns
Map of N-nearest neighbors, sorted by distance

References Digikam::KDNodeBase::NodeCompareResult::distance1, and Digikam::KDNodeBase::NodeCompareResult::result.


The documentation for this class was generated from the following files: