Exposed HierarchicalClusteringIndex in OpenCV wrapper

This commit is contained in:
Marius Muja
2012-09-27 03:58:17 -07:00
parent 56200dbd37
commit 7236858bea
4 changed files with 83 additions and 75 deletions

View File

@@ -137,6 +137,7 @@ enum flann_distance_t
FLANN_DIST_CS = 7,
FLANN_DIST_KULLBACK_LEIBLER = 8,
FLANN_DIST_KL = 8,
FLANN_DIST_HAMMING = 9,
// deprecated constants, should use the FLANN_DIST_* ones instead
EUCLIDEAN = 1,

View File

@@ -619,13 +619,13 @@ private:
if (checks>=maxChecks) {
if (result.full()) return;
}
checks += node->size;
for (int i=0; i<node->size; ++i) {
int index = node->indices[i];
if (!checked[index]) {
DistanceType dist = distance(dataset[index], vec, veclen_);
result.addPoint(dist, index);
checked[index] = true;
++checks;
}
}
}

View File

@@ -100,6 +100,12 @@ struct CV_EXPORTS AutotunedIndexParams : public IndexParams
float memory_weight = 0, float sample_fraction = 0.1);
};
struct CV_EXPORTS HierarchicalClusteringIndexParams : public IndexParams
{
HierarchicalClusteringIndexParams(int branching = 32,
cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, int trees = 4, int leaf_size = 100 );
};
struct CV_EXPORTS KMeansIndexParams : public IndexParams
{
KMeansIndexParams(int branching = 32, int iterations = 11,