From 3ea44f142b89c3de24daa33f122d42014aa906b1 Mon Sep 17 00:00:00 2001 From: Lukasz Janyst Date: Mon, 26 Nov 2018 10:49:23 +0100 Subject: [PATCH] Remove a cluster from the cluster list if no close descriptors were found Fixes #39. --- include/DBoW2/TemplatedVocabulary.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/DBoW2/TemplatedVocabulary.h b/include/DBoW2/TemplatedVocabulary.h index 6d8d6210..cdd36ad7 100644 --- a/include/DBoW2/TemplatedVocabulary.h +++ b/include/DBoW2/TemplatedVocabulary.h @@ -712,6 +712,10 @@ void TemplatedVocabulary::HKmeansStep(NodeId parent_id, F::meanValue(cluster_descriptors, clusters[c]); + if (clusters[c].empty()) { + clusters.erase(clusters.begin() + c); + } + } } // if(!first_time)