5

I am using the SACSegmentation from PCL segmentation module in order to filter out the groundplane.

The method is fitting the front surface of the 3D object instead of fitting the groundplane as shown in 2nd pcd file below.

Any suggestions what should I do in order to fit and filter the ground plane points.

Thanks in advance.

pcl::ModelCoefficients::Ptr coefficients(new pcl::ModelCoefficients);

pcl::SACSegmentation<pcl::PointXYZ> segmentation;

segmentation.setInputCloud(cloudAll);

segmentation.setOptimizeCoefficients(true);

segmentation.setModelType(pcl::SACMODEL_PLANE );

segmentation.setMethodType(pcl::SAC_RANSAC );

segmentation.setDistanceThreshold(20.20);

Scene*.PCD

After the ground plane segmentation

afterApplyingPassthrough

2017_John
  • 99
  • 2
  • 9
  • Please add the images to your post, some people (like me) may not be able to access them behind company firewalls; besides, your link may be broken one day. – calocedrus Apr 24 '18 at 06:34

1 Answers1

5

The problem is that Ransac finds the plane which fits the higher number of points, which in your point cloud corresponds to the front surface.

If you have some knowledge about the scene and the coordinate system on which the point cloud is represented you can easily workaround the problem as follows:

1.

Use PCL's PassThrough filter to select only the points of the point cloud which are above some y value of your choice.

Here I'm assuming that y represents the vertical axis in the given point cloud coordinate system.

This threshold should be based on your knowledge of the dimensions of the scene.

Based on your point cloud you should select the points with y > 200.

Your point cloud:

enter image description here

Selecting only points with y > 200:

enter image description here

  1. Perform the segmentation as you did but this time only using the selected subset of points.

Here is a visualization of the properly fitted plane using the selected points:

enter image description here

sat
  • 91
  • 8
David de la Iglesia
  • 2,436
  • 14
  • 29
  • Great! Thanks alot. your post is really useful. As my main goal is to get the centerpoint/centroid of the 3D object/container, if you look at the recently posted *.pcd file(afterApplyingPassthrough) where I used only passthroughfilter to discard the floor points and wheels assuming that the offset from floor is always known. After applying passthrough as shown in *.pcd above. Which method you recommend for centerpoint? – 2017_John Mar 08 '17 at 12:07
  • I tried to compute the centroid of the remaining object(without floor points and wheels) 1) pcl::compute3DCentroid(*cloudExtracted, centroid) returned xyz(44.0321, -300.226, 1616.87) Another idea is to find the 2) boundingbox for the remaining object. One additional question, which development environment you are using. it seems quite good (eclipse,VStudio etc) – 2017_John Mar 08 '17 at 12:08
  • 1
    @2017_John I think that you should ask the centerpoint question as a new S.O. question so other people can read it, and answer; not only people reading this post. I'd be happy to answer here but I think that a new question is more in concordance with how S.O. works. – David de la Iglesia Mar 08 '17 at 15:36
  • 1
    For working with point clouds I use: [my own python library](https://github.com/daavoo/pyntcloud) (I'm still designing the api so it's not ready for users yer), PCL and [CloudCompare](http://www.danielgm.net/cc/). CloudCompare is the best option for working **non-programmatically** with point clouds. – David de la Iglesia Mar 08 '17 at 15:38