mkazhdan / PoissonRecon

Poisson Surface Reconstruction
MIT License
1.59k stars 427 forks source link

PoissonRecon crashes when using --fullDepth #184

Open burnsjake opened 3 years ago

burnsjake commented 3 years ago

I've compiled PoissonRecon from source on linux and have a point cloud of 31,275,690 points that clocks in around 850MB in size. The point cloud is from a lidar scan.

I'm running: PoissonRecon --in mycloud.ply --out newmesh.ply --depth 15 --fullDepth 9 --normals 2 --threads 24 --parallel 0 --performance --verbose

I'm running on a machine with 24CPU cores and 512GB RAM.

I've been able to run a depth 14 and if I leave out "--fullDepth" configs, the process completes but, I get a surface with lots of holes in it. My understanding is that poisson should give a watertight mesh.

When I use a --fullDepth option it crashes with this:


*************************************************************
*************************************************************
** Running Screened Poisson Reconstruction (Version 13.72) **
*************************************************************
*************************************************************
    --in ./croppedpointcloud3.ply
    --depth 15
    --out precon15-9.ply
    --verbose
    --threads 24
    --fullDepth 9
    --normals 2
    --performance
    --parallel 0
[WARNING] Src/FEMTree.Initialize.inl (Line 224)
          Initialize
          Found bad sample nodes: 1868
Input Points / Samples: 31275690 / 29929871
# Read input into tree:      72.5 (s),   19681.4 (MB) /   19681.4 (MB) / 21825 (MB)
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

I'm wondering what options I can use to get the most accurate watertight reconstruction with the specs of the machine I'm trying this on.

I'm also wondering if --fulldepth is the Octree depth? It's not clear in the readme or help.

I'm also wondering if what the non-manifold option does?

mkazhdan commented 3 years ago

Out of curiosity, what happens if you only keep the --in, --depth, --out, and --verbose flags? I'm guessing that the error you're getting is because your --fullDepth value is too large. (This specifies the depth up to which you want to be using a complete, i.e. not adaptive, grid representation. For example, if you set it to 10, you would be storing multiple 1K x 1K x 1K grids in memory (with each one taking up 4GB of memory). For the iso-surface extraction, the implementation natively extracts a manifold polygon mesh. This is then triangulated using a minimal area triangulation which could, in principal, give a non-manifold triangulation of the surface. By default, the code checks that this doesn't happen. Though if you don't care, you can tell it that non-manifold is OK. (Note that the output surface will still be water-tight.)

Just to be clear, when I say that the surface is "water-tight", I really mean "up to clipping by the bounding box". If the surface extends beyond the bounding box, it will get trimmed and you will have boundary curves (in the faces of the bounding box).

What happens if you run at a lower depth?

If you can share your code, I can also try to take a look.

burnsjake commented 3 years ago

This ia a link to the point cloud I'm trying to run the poisson reconstruction on. https://drive.google.com/file/d/1wZs4NGf9QoADD5ONcGH_5lhWhvEjJn1w/view?usp=sharing

Here is a visualization of the output from running with "depth" set to 15 and "fulldepth" set to 9. poissonwithholes

If I use meshlab to do a poisson reconstruction, I can max out at depth 12, with octree set to 9, but there are no holes. I believe meshlab incorporates an older algorithm of from 2013.

mkazhdan commented 3 years ago

I'm wondering if the problem is caused by your mesh being too big. Can you try using the ChunkPLY executable to decompose your model into smaller chunks and then view each one independently. For example, if your reconstruction is called "out.ply" you can call: ChunkPLY.exe --in 1 out.ply --out out.chnks --width 1000 --verbose This should generate a bunch of small files (chunks) called out.chnks...ply You can then examine each chunk independently to see if there are still holes.

mkazhdan commented 3 years ago

Also, it's possible that your dataset is too large for 32-bit indexing. You can try addressing this by replacing the line "#undef BIG_DATA" in PreProcessor.h with "#define BIG_DATA". I would recommend running your code without the --fullDepth flag, and without the "--normals 2" flag either.