Added min polygon cluster size option (DbViewer and GUI export)

This commit is contained in:
matlabbe
2016-09-03 18:59:43 -04:00
parent 0848b03127
commit 7f2c118f8d
10 changed files with 602 additions and 284 deletions
+37
View File
@@ -100,6 +100,43 @@ void createPolygonIndexes(
}
}
std::list<std::list<int> > clusterPolygons(
const std::vector<std::set<int> > & neighborPolygons,
int minClusterSize)
{
std::set<int> polygonsChecked;
std::list<std::list<int> > clusters;
for(unsigned int i=0; i<neighborPolygons.size(); ++i)
{
if(polygonsChecked.find(i) == polygonsChecked.end())
{
std::list<int> currentCluster;
currentCluster.push_back(i);
polygonsChecked.insert(i);
for(std::list<int>::iterator iter=currentCluster.begin(); iter!=currentCluster.end(); ++iter)
{
// get neighbor polygons
std::set<int> neighbors = neighborPolygons[*iter];
for(std::set<int>::iterator jter=neighbors.begin(); jter!=neighbors.end(); ++jter)
{
if(polygonsChecked.insert(*jter).second)
{
currentCluster.push_back(*jter);
}
}
}
if(currentCluster.size() > minClusterSize)
{
clusters.push_back(currentCluster);
}
}
}
return clusters;
}
std::vector<pcl::Vertices> organizedFastMesh(
const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud,
double angleTolerance,