Search code examples
point-cloud-libraryprinter-control-languageransac

How to prevent plane fitting of plane on xz and yz axes?


I have this code:

SACSegmentation<PointXYZ> seg;
seg.setAxis(Vector3f(0, 0, 1));
seg.setEpsAngle(0.5 * M_PI / 180.0);
seg.setModelType(SACMODEL_PLANE);
seg.setMethodType(SAC_RANSAC);
seg.setDistanceThreshold(0.2);
// then set the input cloud and filter..

The axis and epsAngle seem to do nothing at all-- the point cloud still picks up walls when the sensor gets close enough to them that the wall has more points than the ground. I construct the point cloud explicitly from xyz point data, and so PointCloud member variables like sensor_origin_ and sensor_orientation_ are likely not set (unless PointCloud defaults them to something). Could this be the root of my problem? Or am I doing something else wrong?

Other posts I've seen on this problem all suggest setting the eps angle, which I'm already doing. I appreciate your help!


Solution

  • I sniffed around on the PCL docs and found the answer. They don't make it abundantly clear in the documentation, but only SOME of the models are affected by setAxis() and setEpsAngle(). For my application, that model was SACMODEL_PARALLEL_PLANE. You can find the others here: http://docs.pointclouds.org/1.7.0/group__sample__consensus.html.