util3d: added bool segmentFlatObstacles (default false) parameter to segmentObstaclesFromGround() method

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1980 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2014-11-11 21:34:14 +00:00
parent 7efc6aab2d
commit f9e25c2fa6
2 changed files with 32 additions and 23 deletions
+9 -1
View File
@@ -146,7 +146,8 @@ void segmentObstaclesFromGround(
pcl::IndicesPtr & obstacles, pcl::IndicesPtr & obstacles,
float normalRadiusSearch, float normalRadiusSearch,
float groundNormalAngle, float groundNormalAngle,
int minClusterSize) int minClusterSize,
bool segmentFlatObstacles)
{ {
ground.reset(new std::vector<int>); ground.reset(new std::vector<int>);
obstacles.reset(new std::vector<int>); obstacles.reset(new std::vector<int>);
@@ -159,6 +160,8 @@ void segmentObstaclesFromGround(
normalRadiusSearch*2.0f, normalRadiusSearch*2.0f,
Eigen::Vector4f(0,0,100,0)); Eigen::Vector4f(0,0,100,0));
if(segmentFlatObstacles)
{
int biggestFlatSurfaceIndex; int biggestFlatSurfaceIndex;
std::vector<pcl::IndicesPtr> clusteredFlatSurfaces = util3d::extractClusters<PointT>( std::vector<pcl::IndicesPtr> clusteredFlatSurfaces = util3d::extractClusters<PointT>(
cloud, cloud,
@@ -186,6 +189,11 @@ void segmentObstaclesFromGround(
} }
} }
} }
}
else
{
ground = flatSurfaces;
}
if(ground->size() != cloud->size()) if(ground->size() != cloud->size())
{ {
+2 -1
View File
@@ -597,7 +597,8 @@ void segmentObstaclesFromGround(
pcl::IndicesPtr & obstacles, pcl::IndicesPtr & obstacles,
float normalRadiusSearch, float normalRadiusSearch,
float groundNormalAngle, float groundNormalAngle,
int minClusterSize); int minClusterSize,
bool segmentFlatObstacles = false);
template<typename PointT> template<typename PointT>
void projectCloudOnXYPlane( void projectCloudOnXYPlane(