View source code

Surface Reconstruction Tool for 3DTK

Xia Sun's final report for Google Summer of Code 2018


Surface reconstruction tool for 3DTK, is a program within 3DTK for reconstruction of triangulated mesh surfaces from 3D points data, with screened poisson surface reconstruction algorithm. It uses data structures and other tools that are provided with 3DTK. Users can use the recon program with the description in this page to reconstruct mesh surface from points. They can also include the poisson class like the recon program did in their own project to reach these functions.

Poisson surface reconstruction was introduced by Michael Kazhdan et. al. in 2006, and was improved by their team several times after that. Michael Kazhdan’s implementation of this algorithms has been widely used by many other software and tools like MeshLab and PCL, and is still under maintainance by now. The reconstruction algorithm of my tool is also based on it.

The general workflow of this tool is illustrated below. The programs start with users input options, it parses these options and set specified values or default values for all variables. Then it read scans, if user set range filter or reduction parameters, the program will do filter and reduction to get a smaller data size and range. After this, all scans will be registered based on frames or pose info. Then, normal calculation will be performed on each scan, if user chooses to join scans, all scans will be merged into a big dataset as the input of poisson reconstruction, if no join is set, each scan will be used as input of poisson reconstruction individually. After reconstruction, a surface trimming will be applied on the reconstructed models, and models will be written to a specific path in the end.

workflow chart

Sample usages

To use surface reconstruction tool in 3DTK, you can first download code with svn checkout slam6d-code and build the entire project with instruction in

Please know that this tool is not compatible with Ubuntu 14.04 (Trusty) due to a GCC compiler bug. If you are using Ubuntu 14.04, you may set CMake option WITH_MESH to OFF and try other functions of 3DTK.

  1. Use the default sample data under dat/ directory. This sample data is composed of three scans, we join them first with -j tag, since it is relatively sparse and non-closed, we set a trimming value 7 with -T tag to trim extra part away. You can compare the model_all.obj and model_all_trimmed.obj to view the effects of trimming.
    bin/recon dat dat/test/model -d 12 -T 7.0 -j


  2. Use a common points data, for example the Stanford Bunny. A recommended way is convert the original model file into .xyz file that only contains the xyz coordinates, rename it as scan000.3d and put it into a directory for example dat/bunny/, new a file called scan000.pose and put it under the same directory, and then use commands below. Unlike most scan data 3DTK is dealing with, the bunny surface is water-tight (closed), so we set the normal to be outward by adding a -I tag. For most scans data we use the default normal that are towards the scanner which we called inward.
    bin/recon dat/bunny dat/bunny/model -I


  3. Use Thermobremen data (No.22 on this page), a typical city scan data. This dataset is with file format uosr, we set it with -f tag. Since it is relatively large, we set an auto reduction with -a tag. We also set scans joining , poisson octree depth 12 and trimming value 9.0.
    bin/recon dat/testdata/thermobremen dat/testdata/thermobremen/result -f uosr -a -j -d 12 -T 9


  4. Use Thermocolorlab data (No.20 on this page), a typical indoor colored scan data. This dataset is with file format uos_rrgbt, so we set it with -f first. This scan range is extremly large, we are only going to reconstruct surface within one room here, so we filter part of it with -u tag, the filter range is -500 to 500 on x,y and z directions. We set scan number start from 0 and end with 12 with tag -s and -e, because other scans are not within the room we are going to show, so we just skip them for better speed and lower memory usages. We also set scan joing, octree depth and trimming value. To generate surface with color info, we have to use -C tag.
    bin/recon dat/testdata/thermocolorlab/ dat/testdata/thermocolorlab/model -j -f uos_rrgbt -d 12 -T 8 -s 0 -e 12 -u "11;6;-500;500;-500;500;-500;500" -C


  5. Use Ostia data, another indoor colored scan data. Very similar to the Thermocolorlab data, this sample demonstrate that you could use only part of the scan by removing extra scans files. We first set file format to uos_rgb and use color as input data. Then set poisson octree depth 12 and trimming value 9.0.
    bin/recon dat/testdata/ostia dat/testdata/ostia -j -f uos_rgb -d 12 -T 9 -C


  6. Use Randersacker data (No.26 on this page), a typical natrual open scene data. For this kind of large dataset, certain kinds of reduction and filtering is needed before reconstruction. You can either use --a option like Thermobremen data above, or to manually set reduction parameters with -r option and -O options. To set a range filter, you can use -u tag.
    But sometimes for large dataset, reduction process will take a large number of time, finding an appropriate reduction parameters may take more time, so it is recommended that you use bin/scan_red program to reduce and filter scans first, then use the new files as data source for reconstruction.
    Usages below use scan_red to reduce scans first, then use recon program to generate mesh surface.
    Scan data of objects like tree leaves are not exactly ‘surface’ but more like a ‘volume’, so the reconstruction of tree leaves might be noisy. This sample is more likely to be a demo.
    bin/scan_red -s 0 -e 3 -f uosr --reduction OCTREE --voxel 20 --octree 10 dat/testdata/randersacker/
    bin/recon dat/testdata/randersacker/reduced dat/testdata/randersacker/reduced/model -j -d 12 -T 9 -u "11;6;-1000;1000;-2000;2000;-1000;1000"


Options list

I/O options
Reduction and filter options
Normal calculation options
Poisson options


Commits can be viewed on Source Forge commits list. Most of my source codes and changes are within include/mesh and src/mesh directories.

Problems & Future work

1. Normal calculation: The current normal calculation is indeed very useful and robust. But it would be better if it can have a better identity near edges area. This problem is identical for sparse data. For real data with relatively high points density, normal calculation near edges looks relatively okay.

2. Scan joining: Current scan joining load all scans and perform a transformation on each of them and reach a final registration scan in the end. Maybe joining specific scans with real relationships would be more useful. For example, among 100 scans, scan004 to 009 generates all faces of a building, then we should cluster these scans together and calculate normals for them, this would avoid edge problem in the normal calculation. To reach this, some tag might be needed for each scan, that cluster a large scene into several water-tight objects.

3. Mesh rendering: Currently, all rendering results in this page are screenshots from MeshLab. It would be great if a basic mesh renderer could be added into show or qtshow. This way users can quickly view the surface they are just reconstructed. Or to be more advanced, surface may be rendered together with point set.

4. Mesh processing: Originally I was going to add some mesh processing functions, but after all, only a surface trimmer is truly added and used. Maybe some mesh processing tools could be added in the future, with CGAL that is already introduced into 3DTK. But the priority of mesh processing might not be very high because I think 3DTK is originally designed for point data, surface mesh should be the output, and further processing would be on the next stage of work.

5. Other poisson options I did not include all parameters of Poisson reconstruction into my work, because many of them are for research design purpose that might not be very useful for common data, and have not been truly tested. It would be great to test all of the options and provide interfaces for those useful ones.

6. Ohter reconstruction methods Poisson reconstruction is a typical implicit reconstruction method, some other explicit ones might be introduced in the future. Since different data might fit different methods. Within the mesh/poisson directory there is a SSDRecon, since it shares similar data structures and workflow with PoissonRecon, it might be good to also introduce it into recon program.

References papers

Elseberg, J., Borrmann, D., Nüchter, A.: One Billion Points in the Cloud – An Octree for Efficient Processing of 3D Laser Scans. Isprs Journal of Photogrammetry & Remote Sensing, 2013, 76(1):76-88.</p>

Kazhdan, M., Bolitho, M., Hoppe, H.: Poisson Surface Reconstruction.: Proceedings of the Eurographics Symposium on Geometry Processing 2006. 2006:61-70.

Kazhdan, M., Hoppe, H.: Screened Poisson Surface Reconstruction. Acm Transactions on Graphics, 2013, 32(3):1-13.

Borrmann, D., Hess, R., Eck, D., Houshiar, H., Nüchter, A., Schilling, K.: Evaluation of Methods for Robotic Mapping of Cultural Heritage Sites.Proceedings of the 2th IFAC conference on Embedded Systems, Computer Intelligence and Telematics (CESCIT ‘15). p. 105–110.