introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.83k stars 787 forks source link

Using Fast GP3 and Organized Surface Reconstruction via CLI #1309

Closed nirmalsnair closed 3 months ago

nirmalsnair commented 4 months ago

Hi @matlabbe, Is it possible to use the Fast GP3 or Organized surface reconstruction methods instead of Poisson via command line? In my tests, I found Poisson (55s) to be much slower compared to Fast GP3 (20s) and Organized (15s).

matlabbe commented 4 months ago

You would have to change the code here: https://github.com/introlab/rtabmap/blob/08a44ec44f2cc9c68c64bd3e7a75bbcaeb71fa38/tools/Export/main.cpp#L1798-L1805 and change it for gp3 following that tutorial for example: https://pcl.readthedocs.io/projects/tutorials/en/latest/greedy_projection.html#greedy-triangulation

For Organized, that would be more difficult to do, but not sure this is an useful reconstruction though. Organized creates meshes independently for each image, it doesn't create mesh on the merged cloud like Poisson and GP3.

To increase speed of Poisson, you can lower the resolution with --poisson_depth (set to 8 or 9)

nirmalsnair commented 4 months ago

Thanks @matlabbe, will try to modify the code to make Fast GP3 available via CLI.

nirmalsnair commented 4 months ago

Organized creates meshes independently for each image, it doesn't create mesh on the merged cloud like Poisson and GP3.

On my test data, Organized is generating a single mesh just like the other two methods.

(Generated via GUI using the default export parameter values with 'Meshing' and 'Texture mapping' enabled)

Poisson Screenshot 2024-07-23 153304

Fast GP3 Screenshot 2024-07-23 153809

Organized Screenshot 2024-07-23 153816

matlabbe commented 4 months ago

Organized generates one file, but some polygons taken from different cameras may overlap. For example, when two cameras overlap, you would see two surfaces overlapping when zooming in. With Poisson, only one surface would be generated (like an average of the two surfaces).

nirmalsnair commented 4 months ago

Understood, thanks for the clarification.

On a different note, I've noticed that during the mesh export, the GPU usage remains almost zero, even when using the RTAB-Map CUDA version (RTABMap-0.21.4-win64-cuda117.exe). Is this typical? Is there a way to utilize the GPU to speed up the mesh export?

matlabbe commented 4 months ago

The cuda version doesn't convert the whole code to cuda, only some parts of it and there is always an explicit parameter attached to (e.g. some visual features can be computed on gpu). If you use a ZED camera, it is better to use cuda version (rectification/depth computed on gpu).

nirmalsnair commented 4 months ago

We are using the iOS app to capture data without any issues. On the PC, we only perform mesh export and are curious why the GPU is not utilized at all.

matlabbe commented 3 months ago

Under the hood, we use PCL mesh reconstruction, which is running on CPU.