[ros-users] Set orientation of plane for SACSegmentation

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: ros-users@code.ros.org
Date:  
To: ros-users
Subject: [ros-users] Set orientation of plane for SACSegmentation

Hi everybody,

I am trying to extract the ground plane from a point cloud using pcl
and SACSegmentation. I implemented the segmentation similar to the
code of the "Planar model segmentation"-tutorial for pcl.

This works great to extract the dominant plane of the point cloud. Now
I want to specify the axis and the epsAngle to avoid that e.g. walls
are recognized as dominant planes.

Here the relevant code:

void getDominantPlane(const pcl::PointCloud<pcl::PointXYZ>& cloud){
pcl::ModelCoefficients coefficients;
pcl::PointIndices inliers;

pcl::SACSegmentation<pcl::PointXYZ> seg;
seg.setOptimizeCoefficients (true);
seg.setModelType (pcl::SACMODEL_ORIENTED_PLANE);
seg.setMethodType (pcl::SAC_RANSAC);
seg.setDistanceThreshold (distanceThres);

seg.setAxis(Eigen::Vector3f(axisX,axisY,axisZ));
seg.setEpsAngle( epsAngle/180.0*3.14 );

seg.setInputCloud (boost::make_shared<pcl::PointCloud<pcl::PointXYZ>
>(cloud));

seg.segment (inliers, coefficients);

...
}

AxisX, axisY, axisZ and epsAngle are set with dynamic_reconfigure. But
changing these parameters has no effect to the result of the
segmentation. What am I doing wrong?

Thanks in advance,
Sabrina