ultravideo / Open3DGen

Open-Source software for reconstructing textured 3D models from RGB-D images
MIT License
120 stars 26 forks source link

Open3DGen

Building

Ubuntu 21.04 -based Linux distros should work. Tested on Pop-os 21.04.

Hardware Requirements

OpenGL 4.6 capable GPU, any decently modern GPU should do. With higher resolution textures (4k, 8k) 64Gb of RAM is recommended. This requiremenet will be fixed in a future release. Multicore CPU is recommended, as Open3DGen is highly parallelized.


Recommended RAM amounts:

Dependencies

The following dependencies can be found in the repositories:

libboost1.71-all-dev
libopencv-dev
libopencv-contrib-dev
libopen3d-dev
libglfw-dev
libglew-dev
libopengl-dev

and can be installed with the command

sudo apt install -y libboost1.71-all-dev && sudo apt install -y libopencv-dev && sudo apt install -y libopencv-contrib-dev && sudo apt install -y libopen3d-dev && sudo apt install -y libglfw3-dev && sudo apt install -y libglew-dev && sudo apt install -y libopengl-dev

Installing GTSAM requires building from source: https://github.com/borglab/gtsam.

Make sure clang is also installed. Clang12 was used on the development platform.

Build

At this point building the project should be as simple as running ./build.sh.

Notes for Developers

If LanguageServerProtocol is used for code analysis and autocompletion, compile_commands can be generated with

cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
cd ..
ln build/compile_commands.json .


A quick way to compile or compile and run is to use the shell scripts ./only_compile.sh and ./compile_and_run.sh. Make sure to modify compile_and_run.sh to use the correct command line arguments.

How to Use

Open3DGen requires at least 3 command line arguments to run:

in 'path to input rgbd sequence'
intr 'path to camera intrinsics'
out 'path to the output directory'

For example,

./build/Open3DGen in data_files/sequence intr data_files/realsense_intrinsic_1280.matrix out out/

The input RGBD sequence is expected to be separated into 2 folders: rgb/ and depth/. The RGB images should be named in the format of rgb_number.png (e.g. rgb_0.png) and the depth images should be in the format of depth_number.png (e.g. depth_0.png). The corresponding rgb and depth image must have the same number, and the numbers are expected to be in ascending order.

The camera_intrinsics.matrix -file contains the image dimensions and the calibrated camera intrinsics. The expected format is

width;height
fx;0.0;cx
0.0;fy;cy;
0.0;0.0;1.0


For example, realsense_intrinsic_1280.matrix contains

1280;720
912.91984103;0.0;637.74400638
0.0;912.39513184;358.96757428
0.0;0.0;1.0


Do not modify the values set in the texture projection shader, correct values are loaded automatically.

The visualization can be disabled by commenting the line #define DEBUG_VISUALIZE in the file src/constants.h.

Demo Scene

A demo RGB-D sequence is provided here. Extract the demo_rock folder into data_files/, and execute the following command.

./build/Open3DGen in data_files/demo_rock/ intr data_files/realsense_intrinsic_1280.matrix out data_files/out/ refine_cameras false reject_blur 1.1 crop false skip_stride 28 unwrap true pipeline full poisson_depth 7 simplify_voxel_size 0.075 out_res 4096 depth_far_clip 3.0 max_feature_count 750 assets_path data_files/

The resulting .obj, .mtl and textures will be in the folder data_files/out/. It is recommended the _dilated.png texture is used. Use e.g. Blender to visualize the results.

The RGB-D sequence is not particularly high quality and contains an unfortunate amount of blur. Better sequence will be provided when the weather so allows. The result should look like this demo_rock_out


Command Line Arguments

The supported command line arguments are as follows

Known issues and TODO

Paper

If you are using Open3DGen in your research, please refer to the following paper:
T. T. Niemirepo, M. Viitanen, and J. Vanne, “Open3DGen: Open-Source software for reconstructing textured 3D models from RGB-D images,” Accepted to ACM Multimedia Syst. Conf., Istanbul, Turkey, Sept.-Oct. 2021.