Trouble with Greedy Projection Triangulation

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

Trouble with Greedy Projection Triangulation

Yves Daoust

 

I am meshing a point cloud with the Greedy Projection Triangulation, using the code below, directly inspired by the tutorial.

 

Despite my efforts to adjust the parameters (IMO the  most important of which are Mu and Search Radius), I can’t obtain satisfactory results. The meshed surface always has numerous and large holes. My cloud is 0.67 units in its longest dimension and the point density is very uniform.

 

I would expect increasing the Search Radius to reduce the holes, but no, I am wrong. Actually, the settings seem to have very little influence on the output.

 

Any idea how to solve this ?

 

void MeshGreedy(pcl::PointCloud<pcl::PointXYZ>::Ptr CloudPtr, pcl::PolygonMesh& Mesh, float Radius)

{

       // Greedy triangulation method

 

       // Normal estimation*

       pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> Estimation;

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

       pcl::search::KdTree<pcl::PointXYZ>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZ>);

       tree->setInputCloud(CloudPtr);

       Estimation.setInputCloud(CloudPtr);

       Estimation.setSearchMethod(tree);

       Estimation.setKSearch(20);

       Estimation.compute(*Normals);

       //* normals should not contain the point normals + surface curvatures

 

       // Concatenate the XYZ and normal fields*

       pcl::PointCloud<pcl::PointNormal>::Ptr CloudWithNormals(new pcl::PointCloud<pcl::PointNormal>);

       pcl::concatenateFields(*CloudPtr, *Normals, *CloudWithNormals);

       //* CloudWithNormals = cloud + normals

 

       // Create search tree*

       pcl::search::KdTree<pcl::PointNormal>::Ptr tree2(new pcl::search::KdTree<pcl::PointNormal>);

       tree2->setInputCloud(CloudWithNormals);

 

       // Initialize objects

       pcl::GreedyProjectionTriangulation<pcl::PointNormal> Greedy;

 

       // Set the maximum distance between connected points (maximum edge length)

       Greedy.setSearchRadius(0.025);

 

       // Set typical values for the parameters

       Greedy.setMu(2.5);

       Greedy.setMaximumNearestNeighbors(100);

       Greedy.setMaximumSurfaceAngle(M_PI / 4); // 45 degrees

       Greedy.setMinimumAngle(M_PI / 18); // 10 degrees

       Greedy.setMaximumAngle(2 * M_PI / 3); // 120 degrees

 

       Greedy.setNormalConsistency(true);

       Greedy.setConsistentVertexOrdering(true);

 

       // Get result

       Greedy.setInputCloud(CloudWithNormals);

       Greedy.setSearchMethod(tree2);

       Greedy.reconstruct(Mesh);

}

 

 


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

Re: Trouble with Greedy Projection Triangulation

Sérgio Agostinho

Given those problems I would go in two directions:

  1. Relax constraints even further. You have min and max angles set to certain values. Increase these tolerances to the point they're no longer filtering anything based on this criteria
  2. Isolate the cases which are failing: find the vertices which produce holes and start debugging what criteria is failing. This is likely to require you to inject custom code into the library to help your trace the problem quicker.


Cheers



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

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with Greedy Projection Triangulation

Yves Daoust
Trying extreme values for the parameters (like angles 0 or 180°) doesn't
solve the case. There are still awful holes in a surface that looks easy to
mesh.

For some settings, I get cryptic messages like below:

Not enough neighbors are considered: ffn or sfn out of range! Consider
increasing nnn_... Setting R=4498 to be BOUNDARY!
Not enough neighbors are considered: source of R=4403 is out of range!
Consider increasing nnn_...
Number of neighborhood size increase requests for fringe neighbors: 9
Number of neighborhood size increase requests for source: 30



--
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: Trouble with Greedy Projection Triangulation

Sérgio Agostinho
I see you activated setNormalConsistency. Have you visualized your
normals to make sure they're properly oriented? Have you tried setting
this to false?

If the above fails then it's deep debug stage from now on. I have no
further advice other than: isolate the failing points (pcl provides some
tools to interactively edit point clouds) download that paper and go
through the implementation till you find the problem.

Cheers



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

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with Greedy Projection Triangulation

Yves Daoust
Normal consistency is a flag to enforce consistency of the normals of the mesh (there is a flag for the normal at vertices and another for the normal to the faces). It is not about consistency of the input normals (which is not required - the sample program estimates them with NormalEstimation). I tried both true and false.

My problem is not normal consistency, it is about the numerous missing faces and the fact that parameter adjustment seems to have little or no impact.

I cannot imagine that the greedy projection method can fail so grossly on an easy point cloud. So I must be missing something.

-----Original Message-----
From: PCL-users [mailto:[hidden email]] On Behalf Of Sérgio Agostinho
Sent: Saturday, March 3, 2018 11:06 AM
To: [hidden email]
Subject: Re: [PCL-users] Trouble with Greedy Projection Triangulation

I see you activated setNormalConsistency. Have you visualized your normals to make sure they're properly oriented? Have you tried setting this to false?

If the above fails then it's deep debug stage from now on. I have no further advice other than: isolate the failing points (pcl provides some tools to interactively edit point clouds) download that paper and go through the implementation till you find the problem.

Cheers



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