Problem by displaying Correspondences (Registration)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem by displaying Correspondences (Registration)

Jue_KA
Hello Everyone,

I have problem with displaying two pointclouds and their correspondences
with the PCLVisualizer from this tutorial:
http://pointclouds.org/documentation/tutorials/pcl_visualizer.php

The program compiles, and I can run it. The message in the terminal after
the program is finished is "Segmentation fault (core dumped)"

Here is my code:

The Viewer:

boost::shared_ptr<pcl::visualization::PCLVisualizer>
corrVis(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud5,
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud6,
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_key,
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud2_key,
boost::shared_ptr<pcl::Correspondences> corr1)
{
  boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new
pcl::visualization::PCLVisualizer ("3D Viewer"));
  viewer->setBackgroundColor (0,0,0);
  viewer->addPointCloud<pcl::PointXYZ> (cloud5, "cloud5");
  viewer->addPointCloud<pcl::PointXYZ> (cloud6, "cloud6");
  //viewer->addPointCloud<pcl::PointXYZ> (cloud_key, "Keypoints1");
  //viewer->addPointCloud<pcl::PointXYZ> (cloud2_key, "Keypoints2");
  viewer->addCorrespondences<pcl::PointXYZ> (cloud_key, cloud2_key, *corr1,
"Correspondences");
  viewer->setPointCloudRenderingProperties
(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "Correspondence");


  viewer->initCameraParameters();

  return(viewer);
 
}


The Correspondence Estimation:

 boost::shared_ptr<pcl::Correspondences> all_correspondences (new
pcl::Correspondences);
  pcl::registration:: CorrespondenceEstimation<pcl::FPFHSignature33,
pcl::FPFHSignature33> est;
  est.setInputSource (pfhFeatures2);
  est.setInputTarget (pfhFeatures);
  est.determineReciprocalCorrespondences (*all_correspondences);


The correspondence rejection:

  boost::shared_ptr<pcl::Correspondences> corr_filtered (new
pcl::Correspondences);
  pcl::registration::CorrespondenceRejectorSampleConsensus<pcl::PointXYZ>
rej;
  rej.setInputSource(keypoints2_xyz);
  rej.setInputTarget(keypoints_xyz);
  rej.setInlierThreshold(1.2);
  rej.setRefineModel(false);
  rej.setInputCorrespondences(all_correspondences);
  rej.getCorrespondences(*corr_filtered);

and the call for the viewer

  else if (cloud_dc)
   {
     viewer = corrVis(cloud_trans,cloud_down,keypoints_xyz, cloud_trans_key,
corr_filtered);
   }

Can anybody please help...I'm new to PCL and CPP?



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem by displaying Correspondences (Registration)

Jue_KA
I just solved the problem by switching two code lines whereas I defined the
point clouds...



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users