victorprad / InfiniTAM

A Framework for the Volumetric Integration of Depth Images
http://www.infinitam.org
Other
930 stars 351 forks source link

Point cloud output #17

Closed mgualti closed 9 years ago

mgualti commented 9 years ago

Does InfiniTAM provide a routine for getting a point cloud representation of the current scene? I saw that the tracking state has a point cloud in it, but this appears to be from only the most recent depth image.

olafkaehler commented 9 years ago

The point cloud in the tracking state is indeed only used for tracking, i.e. it's the output of the raycast that is used by the next tracking step. It's not a point cloud representation of the whole scene.

The current version of InfiniTAM does not yet support the output of a mesh. However, in some local development branches that still need a lot of cleanup, we've just implemented an "Export to .stl" function, and this is probably going to be merged back into the master branch at some point soon (i.e. July).

mgualti commented 9 years ago

Thanks for your help. Is there an example in the code somewhere for reading out all of the voxels? I found the function readVoxel, but it isn't clear to me yet how to step through all of the active voxels.

rajputasif commented 9 years ago

Waiting anxiously for this update.... Could you also implement the functionality of loading custom depth images? (for eg. PNGs)

olafkaehler commented 9 years ago

In another local branch, I've also implemented PNG support based on libpng. This is most likely also going to be merged at some point, but needs a bit more testing (e.g. Windows/MacOS compatibility).

Regarding the reading of voxels: the readVoxel function is called e.g. from the raycasting functions. It allows reading a voxel given the absolute voxel coordinates and will internally look up the correct block and voxel within this block. I.e. if you are using the readVoxel function, you should not at all notice that there are blocks and a hash function. Otherwise, there is also a list of "live blocks", stored in the scene object, which will give you a list of all visible blocks. You could then walk through the voxels of all visible blocks manually. If the "live blocks" are not sufficient, you'll currently have to go through the entire hash table and check for each entry, whether the voxel block pointer is positive. This gives you a list of all allocated voxel blocks, and you can again read the individual voxels from these.

Be aware, however, that all the data structures are only ever maintained on either the CPU or the GPU and, depending on what you want to do, you might have to manually synchronize them.

mgualti commented 9 years ago

Thanks again. I've almost got something working to extract the points. Do you know how to convert the SDF value into meters?

olafkaehler commented 9 years ago

ITMLibSettings should have some ITMSceneParameters, which should have the voxel size in meters.

joantika commented 9 years ago

Very nice project! I'm also interested to export mesh files :)

olafkaehler commented 9 years ago

Mesh export is now supported in the master branch.

rajputasif commented 9 years ago

Thank you @olafkaehler for stl export support, I have just tried the latest master branch and it works nicely. :+1: Thanks image