[JdeRobot] Detect planes with pcl

rsaezd rebeca.92.saez at gmail.com
Sat May 2 23:10:46 CEST 2015


Hi,

I'm trying to detect planes in my cloud of points with PCL.
I am using the following code to the official documentation of PCL:
*
void Gui::detectPlanes(Mat imageColor, Mat imageD){
    PointCloudT::Ptr output(new PointCloudT);
    pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients);
    pcl::PointIndices::Ptr inliers (new pcl::PointIndices);
    pcl::ExtractIndices<pcl::PointXYZRGBA> indice_extractor;
    //Create the segmentation object
    pcl::SACSegmentation<pcl::PointXYZRGBA> seg;
    seg.setOptimizeCoefficients(true);
    seg.setModelType(pcl::SACMODEL_PLANE);
    seg.setMethodType(pcl::SAC_RANSAC);
    int size= imageD.cols * imageD.rows;
    seg.setMaxIterations(size);
    seg.setDistanceThreshold(0.01);

    int i = 0, nr_points = (int) cloud->points.size();
    //While 30% of the original cloud is still there
    while (cloud->points.size () > 0.3 * nr_points){
         //Segment the largest planar component from the remaining cloud
        seg.setInputCloud(cloud);
        seg.segment(*inliers, *coefficients);
        //Extract the inliers
        indice_extractor.setInputCloud(cloud);
        indice_extractor.setIndices(inliers);
        //Create the filtering object
        indice_extractor.setNegative (true);
        indice_extractor.filter (*output);
        cloud.swap (output);
        i++;
    }
    
    viewer->updatePointCloud(output, "cloud");
    qvtkWidget->update();
}*

But when I run my program, I do not visualize the segmented point cloud.
Also, my program hangs.
I looked documentation and several examples, but don't understand how I can
do this, 

Can someone help me?

Thanks and regards



--
View this message in context: http://jderobot-developer-list.2315034.n4.nabble.com/Detect-planes-with-pcl-tp4642655.html
Sent from the Jderobot Developer List mailing list archive at Nabble.com.


More information about the Jde-developers mailing list