[JdeRobot] Detect planes with pcl
Juan Navarro Bosgos
jnbosgos at gmail.com
Sun May 3 13:32:49 CEST 2015
Hi, Rebeca,
I do not see where you pass the 'cloud' variable to 'detectPlanes'
function, is a global variable?
Anyway, is it necessary that you use the PCL library? Because in my
component mapper3Drgbd [1], I use RANSAC to detect and extract planes from
a point cloud; it may be helpful for your case. If you need more details,
write me an email.
Best regards,
Juan
[1]
http://svn.jderobot.org/users/jnbosgos/pfc-teleco/trunk/components/mapper3Drgbd/
2015-05-02 23:10 GMT+02:00 rsaezd <rebeca.92.saez en gmail.com>:
> 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.
> _______________________________________________
> Jde-developers mailing list
> Jde-developers en gsyc.es
> http://gsyc.escet.urjc.es/cgi-bin/mailman/listinfo/jde-developers
>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://gsyc.escet.urjc.es/pipermail/jde-developers/attachments/20150503/b2fac5a1/attachment.htm
More information about the Jde-developers
mailing list