18 #include <mrpt/config.h> 54 std::map<unsigned, std::vector<unsigned>>
groups;
56 std::map<unsigned, std::vector<unsigned>>
170 std::map<unsigned, std::vector<unsigned>> newGroups;
176 for (
int i = 0; i < group_diff; i++)
179 else if (group_diff < 0)
181 for (
unsigned i = 0; i < parts.size(); i++)
190 std::vector<unsigned> group_limits(1, 0);
192 group_limits.push_back(
196 for (
unsigned i = 0; i < parts.size(); i++)
198 for (
unsigned j = 0; j < parts[i].size(); j++)
202 if (parts[i][j] < group_limits[i] ||
209 if (parts[i][j] >= group_limits[k] ||
210 parts[i][j] < group_limits[k + 1])
217 [parts[i][j] - group_limits[k]] ==
242 [parts[i][j] - group_limits[i]]]
262 for (
auto it = newGroups.begin(); it != newGroups.end(); it++)
263 groups[it->first] = it->second;
268 for (
int i = -1; i >= group_diff; i--)
279 j <
groups.size() - 1; j++)
299 for (
auto it1 = newGroups.begin(); it1 != newGroups.end(); it1++)
302 for (
auto it1 = newGroups.begin(); it1 != newGroups.end(); it1++)
305 for (it2++; it2 != newGroups.end(); it2++)
306 for (
unsigned i = 0; i < it1->second.size(); i++)
309 for (
unsigned j = 0; j < it2->second.size(); j++)
314 vicinity[it1->first].push_back(it2->first);
315 vicinity[it2->first].push_back(it1->first);
348 unsigned current_group_votes = 0;
349 map<unsigned, unsigned> observed_group;
350 for (
auto it = observedPlanes.begin(); it != observedPlanes.end(); it++)
355 for (
auto it = observed_group.begin(); it != observed_group.end(); it++)
356 if (it->second > current_group_votes)
359 current_group_votes = it->second;
365 std::vector<std::vector<uint32_t>>
380 bool different_partition =
false;
382 different_partition =
true;
385 unsigned prev_size = 0;
390 different_partition =
true;
394 for (
unsigned j = 0; j < parts[i].size(); j++)
396 if (parts[i][j] != j + prev_size)
398 different_partition =
true;
402 prev_size += parts[i].size();
406 if (!different_partition)
return -1;
411 current_group_votes = 0;
412 observed_group.clear();
413 for (
auto it = observedPlanes.begin(); it != observedPlanes.end(); it++)
418 for (
auto it = observed_group.begin(); it != observed_group.end(); it++)
419 if (it->second > current_group_votes)
422 current_group_votes = it->second;
void resize(size_t row, size_t col)
std::map< unsigned, std::vector< unsigned > > vicinity
SemanticClustering(PbMap &mPbM)
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()
mrpt::math::CMatrixF connectivity_matrix
This class is a "CSerializable" wrapper for "CMatrixFloat".
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.
int evalPartition(std::set< unsigned > &observedPlanes)
std::vector< Plane > vPlanes
unsigned currentSemanticGroup
A class used to store a Plane-based Map (PbMap).
void buildProximityMatrix()