Skip to content

Plane Finding

hugo-hebert edited this page Jun 21, 2016 · 2 revisions

Description

Plane finding is the process of finding planes in a point cloud. This is used to define objects thanks to planes. This can also be used to remove points that are not part of planes, making the point clouds smaller. It uses PCL's RANSAC implementation and is very costly, so it should not be used on bigger point clouds.


void ModelDetection::colorPlans(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud,double distanceThreshold,int pointsPerPlane);

Example

Here is an example has to how to use the method:


#include <cos/io/cloud_io.h>
#include <cos/ModelDetection.h>

#include <pcl/point_cloud.h>
#include <pcl/point_types.h>

using namespace cloud_object_segmentation;

int main(int argc, char *argv[])
{
    pcl::PointCloud<pcl::PointXYZRGB>::Ptr base_cloud_ptr;

    // reading cloud from a file
    base_cloud_ptr = io::import_cloud("C:/Documents/Clouds/sample_cloud.txt");

    // the second parameter determines how far a point can be from the modelled plane before being an outlier
    // the third parameter is the minimum number of points for a plane to be valid
    modelDetection::colorPlans(base_cloud_ptr, 0.01, 1000);

    // writing cloud to file
    io::export_cloud("C:/Documents/Clouds/homogenized_cloud.txt", base_cloud_ptr);

    return 0;
}

##Results Before the application of the algorithm:

After:

Clone this wiki locally