16 #ifndef __SemanticClustering_H 17 #define __SemanticClustering_H 19 #include <mrpt/config.h> 58 std::map<unsigned, std::vector<unsigned>>
groups;
60 std::map<unsigned, std::vector<unsigned>>
135 cout <<
"neighborGroups: ";
168 cout <<
"Planes in the vicinity: ";
196 std::map<unsigned, std::vector<unsigned>> newGroups;
202 for (
int i = 0; i < group_diff; i++)
206 else if (group_diff < 0)
208 for (
unsigned i = 0; i < parts.size(); i++)
217 std::vector<unsigned> group_limits(1, 0);
223 group_limits.push_back(
231 for (
unsigned i = 0; i < parts.size(); i++)
233 for (
unsigned j = 0; j < parts[i].size(); j++)
237 if (parts[i][j] < group_limits[i] ||
244 if (parts[i][j] >= group_limits[k] ||
245 parts[i][j] < group_limits[k + 1])
252 [parts[i][j] - group_limits[k]] ==
277 [parts[i][j] - group_limits[i]]]
297 for (map<
unsigned, vector<unsigned>>::
iterator it = newGroups.begin();
298 it != newGroups.end(); it++)
299 groups[it->first] = it->second;
304 for (
int i = -1; i >= group_diff; i--)
315 j <
groups.size() - 1; j++)
335 for (std::map<
unsigned, std::vector<unsigned>>::
iterator it1 =
337 it1 != newGroups.end(); it1++)
340 for (std::map<
unsigned, std::vector<unsigned>>::
iterator it1 =
342 it1 != newGroups.end(); it1++)
344 std::map<unsigned, std::vector<unsigned>>
::iterator it2 = it1;
345 for (it2++; it2 != newGroups.end(); it2++)
346 for (
unsigned i = 0; i < it1->second.size(); i++)
349 for (
unsigned j = 0; j < it2->second.size(); j++)
354 vicinity[it1->first].push_back(it2->first);
355 vicinity[it2->first].push_back(it1->first);
388 unsigned current_group_votes = 0;
389 map<unsigned, unsigned> observed_group;
391 it != observedPlanes.end(); it++)
397 it != observed_group.end(); it++)
398 if (it->second > current_group_votes)
401 current_group_votes = it->second;
407 std::vector<mrpt::vector_uint> parts;
421 bool different_partition =
false;
423 different_partition =
true;
426 unsigned prev_size = 0;
431 different_partition =
true;
435 for (
unsigned j = 0; j < parts[i].size(); j++)
437 if (parts[i][j] != j + prev_size)
439 different_partition =
true;
443 prev_size += parts[i].size();
447 if (!different_partition)
return -1;
452 current_group_votes = 0;
453 observed_group.clear();
455 it != observedPlanes.end(); it++)
461 it != observed_group.end(); it++)
462 if (it->second > current_group_votes)
465 current_group_votes = it->second;
static void RecursiveSpectralPartition(GRAPH_MATRIX &in_A, std::vector< vector_uint > &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.
std::map< unsigned, std::vector< unsigned > > vicinity
SemanticClustering(PbMap &mPbM)
for(ctr=DCTSIZE;ctr > 0;ctr--)
mrpt::math::CMatrix connectivity_matrix
std::vector< unsigned > planesVicinity_order
std::map< unsigned, std::vector< unsigned > > groups
std::vector< unsigned > neighborGroups
static std::vector< unsigned > DEFAULT_VECTOR_U
void buildCoVisibilityMatrix()
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void arrangeNewGroups(std::vector< mrpt::vector_uint > &parts)
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).
void buildProximityMatrix()