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)