pyntcloud icon indicating copy to clipboard operation
pyntcloud copied to clipboard

Processing models with large number of voxels

Open MitkoAle opened this issue 5 years ago • 2 comments

I am trying to process large models using small voxels and I usually have memory problems. I guess there are two things that can be done to improve this.

  1. Using Minimum Volume Bounding Box to align the voxels model with input data, and have less empty voxels. model This will reduce to some extend the problem.

  2. Create patch-based voxel system, where the model would be subdivided in many smaller same size voxel models. For example, 32x32x32 size patches which relative position are known compared to the other patches. You can store the patches in some files externally, and use them when you need. This would enable to create a lot of voxels.

MitkoAle avatar Jan 22 '19 00:01 MitkoAle

Hola @MitkoAle ! Thanks for reporting and the suggestions :)

As many things in PyntCloud (actually everithing xD), the VoxelGrid implementation is not optimized at all.

In my opinion, the best way to reduce the memmory usage is to use sparse arrays to store the VoxelGrid information. This requires a little bit of refactoring of the current VoxelGrid code and I really hope to find the time and energy some day to do this.

Regarding your suggestions:

  • 1

This migth be a good solution but it's efectiveness is conditioned by the shape of your point cloud and I'm not sure (at first glance) if adding this logic to VoxelGrid in a generalizable way would be possible.

Regardless, you can use the rotations available in https://github.com/daavoo/pyntcloud/blob/master/pyntcloud/geometry/rotations.py to manually aling the point cloud before computing the VoxelGrid.

  • 2

If I understand correctly the thing you are describing is some sort of Octree. This is a widely use solution and I think that it should not be part of / extend the VoxelGrid structure but rather should be implemented as an independent structure.

The only reason of not having an Octree structure so far is that I haven't been able to implement it in "pure" Python (+numpy) in a satisfactory way. I might try to wrap some existing external implementations.

daavoo avatar Feb 07 '19 06:02 daavoo

Hola @daavoo ! :)

I've not worked with sparse and dense arrays. Probably, the computational time would be better using them.

Regarding the suggestions:

  • 1

I agree with you that a manual rotation can be a solution.

  • 2

I'm not talking about octree structures. I think Minecraft uses such kind of structure that I suggest, keeping huge models in smaller voxel models as separate objects. In this way, you can have a lot of small voxel models knowing their position, which represent the main voxel model instead. I guess if you store them in some files during the voxel creation you can think of working with very small voxels.

Mitko88 avatar Feb 13 '19 04:02 Mitko88