16 #ifndef __SemanticClustering_H
17 #define __SemanticClustering_H
19 #include <mrpt/config.h>
57 std::map<unsigned, std::vector<unsigned>>
groups;
59 std::map<unsigned, std::vector<unsigned>>
134 cout <<
"neighborGroups: ";
167 cout <<
"Planes in the vicinity: ";
195 std::map<unsigned, std::vector<unsigned>> newGroups;
201 for (
int i = 0; i < group_diff; i++)
205 else if (group_diff < 0)
207 for (
unsigned i = 0; i < parts.size(); i++)
216 std::vector<unsigned> group_limits(1, 0);
222 group_limits.push_back(
230 for (
unsigned i = 0; i < parts.size(); i++)
232 for (
unsigned j = 0; j < parts[i].size(); j++)
236 if (parts[i][j] < group_limits[i] ||
243 if (parts[i][j] >= group_limits[k] ||
244 parts[i][j] < group_limits[k + 1])
251 [parts[i][j] - group_limits[k]] ==
276 [parts[i][j] - group_limits[i]]]
296 for (map<
unsigned, vector<unsigned>>::
iterator it = newGroups.begin();
297 it != newGroups.end(); it++)
298 groups[it->first] = it->second;
303 for (
int i = -1; i >= group_diff; i--)
314 j <
groups.size() - 1; j++)
334 for (std::map<
unsigned, std::vector<unsigned>>::
iterator it1 =
336 it1 != newGroups.end(); it1++)
339 for (std::map<
unsigned, std::vector<unsigned>>::
iterator it1 =
341 it1 != newGroups.end(); it1++)
343 std::map<unsigned, std::vector<unsigned>>
::iterator it2 = it1;
344 for (it2++; it2 != newGroups.end(); it2++)
345 for (
unsigned i = 0; i < it1->second.size(); i++)
348 for (
unsigned j = 0; j < it2->second.size(); j++)
353 vicinity[it1->first].push_back(it2->first);
354 vicinity[it2->first].push_back(it1->first);
387 unsigned current_group_votes = 0;
388 map<unsigned, unsigned> observed_group;
390 it != observedPlanes.end(); it++)
396 it != observed_group.end(); it++)
397 if (it->second > current_group_votes)
400 current_group_votes = it->second;
406 std::vector<std::vector<uint32_t>>
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;