Normals calculation fails

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Normals calculation fails

Raph
This post was updated on .
Hi all!
First of all, I wish you a good 2017, and only luck and positive for this new year! ;)

My problem concern the normals calculation from a point Cloud.
I'm using :
       
        pcl::NormalEstimationOMP<pcl::PointXYZ, pcl::Normal> neOMP(8);
        neOMP.setInputCloud(cloud);
        pcl::search::KdTree<pcl::PointXYZ>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZ>());
        neOMP.setSearchMethod(tree);

        pcl::PointCloud<pcl::Normal>::Ptr cloud_normals(new pcl::PointCloud<pcl::Normal>);

        neOMP.setKSearch(100);
        neOMP.compute(*cloud_normals);

        return cloud_normals;


as used on the documentation.
I'm using it on a Pointcloud found by a RANSAC SampleConsensusModel (in order to make a plane PointCloud):       
        pcl::PointCloud<pcl::PointXYZ>::Ptr finale(new pcl::PointCloud<pcl::PointXYZ>);

        std::vector<int> inliers;
  pcl::SampleConsensusModelPlane<pcl::PointXYZ>::Ptr
        model_p(new pcl::SampleConsensusModelPlane<pcl::PointXYZ>(nearests_));
        pcl::RandomSampleConsensus<pcl::PointXYZ> ransac(model_p);
        ransac.setDistanceThreshold(.001);
        ransac.computeModel();
        ransac.getInliers(inliers);
        pcl::copyPointCloud<pcl::PointXYZ>(*nearests_, inliers, *finale);
        pcl::PointCloud<pcl::Normal>::Ptr cloud_normals(new pcl::PointCloud<pcl::Normal>);
        cloud_normals = find_normals(finale, 0.1);


But the result is :


Can it be a problem with the algorithm.
Since I only have to find the normal of the plane created with RANSAC, I was going to implement an algorithm of plane-fitting. Do you know one that is good? PCA? But in what I know, Finding normal is based on PCA algorithm no? So if there is errors here, maybe another could be good?

I'm about to use what I found here since it seem to be working, and "fast" enough. Do you think it's a good idea?
Loading...