16 #ifndef __SemanticClustering_H 17 #define __SemanticClustering_H 19 #include <mrpt/config.h> 55 std::map<unsigned, std::vector<unsigned>>
groups;
57 std::map<unsigned, std::vector<unsigned>>
132 cout <<
"neighborGroups: ";
165 cout <<
"Planes in the vicinity: ";
193 std::map<unsigned, std::vector<unsigned>> newGroups;
199 for (
int i = 0; i < group_diff; i++)
203 else if (group_diff < 0)
205 for (
unsigned i = 0; i < parts.size(); i++)
214 std::vector<unsigned> group_limits(1, 0);
220 group_limits.push_back(
228 for (
unsigned i = 0; i < parts.size(); i++)
230 for (
unsigned j = 0; j < parts[i].size(); j++)
234 if (parts[i][j] < group_limits[i] ||
241 if (parts[i][j] >= group_limits[k] ||
242 parts[i][j] < group_limits[k + 1])
249 [parts[i][j] - group_limits[k]] ==
274 [parts[i][j] - group_limits[i]]]
294 for (map<
unsigned, vector<unsigned>>::
iterator it = newGroups.begin();
295 it != newGroups.end(); it++)
296 groups[it->first] = it->second;
301 for (
int i = -1; i >= group_diff; i--)
312 j <
groups.size() - 1; j++)
332 for (std::map<
unsigned, std::vector<unsigned>>::
iterator it1 =
334 it1 != newGroups.end(); it1++)
337 for (std::map<
unsigned, std::vector<unsigned>>::
iterator it1 =
339 it1 != newGroups.end(); it1++)
341 std::map<unsigned, std::vector<unsigned>>
::iterator it2 = it1;
342 for (it2++; it2 != newGroups.end(); it2++)
343 for (
unsigned i = 0; i < it1->second.size(); i++)
346 for (
unsigned j = 0; j < it2->second.size(); j++)
351 vicinity[it1->first].push_back(it2->first);
352 vicinity[it2->first].push_back(it1->first);
385 unsigned current_group_votes = 0;
386 map<unsigned, unsigned> observed_group;
388 it != observedPlanes.end(); it++)
394 it != observed_group.end(); it++)
395 if (it->second > current_group_votes)
398 current_group_votes = it->second;
404 std::vector<std::vector<uint32_t>>
419 bool different_partition =
false;
421 different_partition =
true;
424 unsigned prev_size = 0;
429 different_partition =
true;
433 for (
unsigned j = 0; j < parts[i].size(); j++)
435 if (parts[i][j] != j + prev_size)
437 different_partition =
true;
441 prev_size += parts[i].size();
445 if (!different_partition)
return -1;
450 current_group_votes = 0;
451 observed_group.clear();
453 it != observedPlanes.end(); it++)
459 it != observed_group.end(); it++)
460 if (it->second > current_group_votes)
463 current_group_votes = it->second;
std::map< unsigned, std::vector< unsigned > > vicinity
SemanticClustering(PbMap &mPbM)
mrpt::math::CMatrix connectivity_matrix
std::vector< unsigned > planesVicinity_order
void arrangeNewGroups(std::vector< std::vector< uint32_t >> &parts)
std::map< unsigned, std::vector< unsigned > > groups
std::vector< unsigned > neighborGroups
static std::vector< unsigned > DEFAULT_VECTOR_U
void buildCoVisibilityMatrix()
int evalPartition(std::set< unsigned > &observedPlanes)
std::vector< Plane > vPlanes
This class is a "CSerializable" wrapper for "CMatrixFloat".
unsigned currentSemanticGroup
A class used to store a Plane-based Map (PbMap).
static void RecursiveSpectralPartition(GRAPH_MATRIX &in_A, std::vector< std::vector< uint32_t >> &out_parts, num_t threshold_Ncut=1, bool forceSimetry=true, bool useSpectralBisection=true, bool recursive=true, unsigned minSizeClusters=1, const bool verbose=false)
Performs the spectral recursive partition into K-parts for a given graph.
void buildProximityMatrix()