Open ahmadhasan2k8 opened 6 years ago
The problem is that mst_orient_normals()
creates a graph where each vertex has an edge to its closest 1000 vertices (that's the Riemannian Graph, the manual mentions). When you say that you have islands then this means that you need this big number so that the Riemannian graph becomes one connected component.
@palliez are you aware of any newer algorithms for orientinig normals, or variants of the Riemannian graph, say several passes with an increasing number of neighbors to consider?
And do you encounter a problem with islands with nParticleShape1.2.xyz.zip ??? Everything looks good for me.
Not for nParticleShape1.2.xyz. I put this data to show memory usage. I get that forming a reimannnian graph might need more meory usage, I was more like suggesting if it was possible to form the graph iteratively somehow so that the memory usage goes down. The uploaded point cloud Des not have islands. If there are islands increasing number of neighbors create memory issues.
However, I got past the problem by using minimum number of neighbors though, 18 as suggested. Steps for that:
That seems to work perfectly and have no memory issues. This way I can solve the island problem and also don't have to use a large number of neighbors
I could write an example code if needed and give a pull request if you want.
You still might get islands that are oriented differently from the "continent", that is the points on the continent may show upwards, and the points on the island downwards. The connectivity is needed for the global propagation. But maybe we can together come up with something.
That's true. It does happen. If the island is too small I just remove it, but yes it's not a global propagation though. But the main purpose for me is to use it for poisson reconstruction. Even if the continent and islands might be oriented differently, poisson reconstruction works just fine. However it doesn't work well when individual connected components have different orientation. So, the process I mentioned above works really well without memory issue. But I do agree that if we could come up with something better that does not have memory issues and can propagate normals globally that would be great.
Are you willing to share a problematic data set?
I probably can't share the original data but I can try to create a similar type of data which could be problematic. I'll give it a shot over the weekend, should not be too difficult
CGAL.zip This could work as an ideal sample data.
How about picking one point from all the islands each and one from the continent to form a graph to span a tree. And then use the continent point as seed for propagation. At this point all the islands will have one point which is globally oriented as the continent. Then, use those points as seed to propagate the orientation in their respective islands. I'm not very sure if this could work but seems to be the right way.
Issue Details
I have a multiple scanned point clouds where I calculate normals using CGAL. I run a Screened Poisson Reconstruction afterwards so I also orient the normals using mst_orient_normals. Now, because the data is scanned, sometimes there are islands of points even after some outlier removal which makes orienting the normals difficult unless I increase the nb_neighbors for mst_orient_normals to almost 500. Each point cloud have almost million points and I use MPI to run several process simultaneously. Problem is, I run out of memory beacuse I think CGAL stores all the neighborhood information in memory and process them altogether. So, even if I can use 18 or some small number for nb_neighbors and have a point cloud of 10~20 millions, and I run say 20 threads, it requires massive memory. Even my swap space becomes almost full, sometimes fails too. If I double the nb_neighbors the Mb allocated also almost doubles. Is there a way to use lower number of neighbors but still get correct orientation in case of islands of point cloud? Is it possible to not store all the data in the memory but process them as you get? I have attached a sample point cloud for testing too. nParticleShape1.2.xyz.zip
Source Code
main.cpp
CMakeLists.txt
Environment