-
Notifications
You must be signed in to change notification settings - Fork 5.8k
GSoC 2017: dynamicfusion #1349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.x
Are you sure you want to change the base?
GSoC 2017: dynamicfusion #1349
Changes from 4 commits
0e38002
11bbe6e
7c12c24
cd918ef
26cbdcd
1974106
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
set(the_description "Non-rigid 3D reconstruction") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -DFORCE_INLINERS -D_MWAITXINTRIN_H_INCLUDED") | ||
|
||
# | ||
## ---[ Solution name | ||
# | ||
## ---[ utility | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/") | ||
include(cmake/Utils.cmake) | ||
#include(cmake/Targets.cmake) | ||
# | ||
## ---[ find dependencies | ||
find_package(CUDA REQUIRED) | ||
#find_package(OpenNI) | ||
find_package(Ceres REQUIRED) | ||
include_directories(${CERES_INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${CUDA_INCLUDE_DIRS} ${OPENNI_INCLUDE_DIR} "kfusion/src/utils" "kfusion/include/nanoflann") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to use existing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll look into porting from nanoflann to flann at some point later |
||
#if(OPENNI_FOUND) | ||
# message("FOUND OPENNI AT: ${OPENNI_INCLUDE_DIR}") | ||
#endif() | ||
## ---[ misc settings | ||
#if(USE_PROJECT_FOLDERS) | ||
# set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
# set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets") | ||
#endif() | ||
# | ||
## ---[ cuda settings | ||
#set(HAVE_CUDA 1) | ||
#list(APPEND CUDA_NVCC_FLAGS "-gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_61,code=sm_61") | ||
# | ||
#if(UNIX OR APPLE) | ||
# list(APPEND CUDA_NVCC_FLAGS "-Xcompiler;-fPIC;") | ||
#endif() | ||
# | ||
#warnings_disable(CMAKE_CXX_FLAGS /wd4985) | ||
# | ||
#set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "--ftz=true;--prec-div=false;--prec-sqrt=false") | ||
#add_module_library(kfusion) | ||
#if(OPENNI_FOUND) | ||
# target_compile_definitions(kfusion PRIVATE OPENNI_FOUND=1) | ||
#endif() | ||
#target_link_libraries(kfusion ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${OPENNI_LIBRARY} ${CERES_LIBRARIES}) | ||
#add_subdirectory(apps) | ||
# | ||
#if(BUILD_TESTS) | ||
# find_package(GTest REQUIRED) | ||
# if( GTEST_FOUND ) | ||
# message( "Found Gtest at ${GTEST_ROOT}") | ||
# message( "GTest Libs: ${GTEST_BOTH_LIBRARIES}") | ||
# message( "GTest Include: ${GTEST_INCLUDE_DIRS}") | ||
# include_directories(${GTEST_INCLUDE_DIRS}) | ||
# add_subdirectory(tests) | ||
# endif() | ||
#endif() | ||
find_package(Boost REQUIRED COMPONENTS system filesystem program_options) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the Boost is not needed anymore. |
||
ocv_define_module(dynamicfusion opencv_core opencv_calib3d opencv_viz opencv_highgui) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any Note that all samples will receive dependency on |
||
|
||
ocv_warnings_disable(CMAKE_CXX_FLAGS | ||
-Wundef | ||
-Wshadow | ||
-Wsign-compare | ||
-Wmissing-declarations | ||
-Wunused-but-set-variable | ||
-Wunused-parameter | ||
-Wunused-function | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2012, Anatoly Baksheev | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the {organization} nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
DynamicFusion | ||
============ | ||
Implementation of [Newcombe et al. 2015 DynamicFusion paper](http://grail.cs.washington.edu/projects/dynamicfusion/papers/DynamicFusion.pdf). | ||
|
||
The code is based on this [KinectFusion implemenation](https://github.com/Nerei/kinfu_remake) | ||
|
||
Dependencies: | ||
* CUDA 5.0 or higher | ||
* OpenCV 2.4.8 or higher (modules opencv_core, opencv_highgui, opencv_calib3d, opencv_imgproc, opencv_viz). Make sure that WITH_VTK flag is enabled in CMake during OpenCV configuration. | ||
* Nanoflann (included in the repository) | ||
* Boost (libraries system, filesystem and program options. Only used in the demo. Tested with [1.64.0](http://www.boost.org/users/history/version_1_64_0.html)) | ||
* Ceres solver (Tested with version [1.13.0](http://ceres-solver.org/ceres-solver-1.13.0.tar.gz)) | ||
|
||
Implicit dependency (needed by opencv_viz): | ||
* VTK 5.8.0 or higher | ||
* SuiteSparse, BLAS and LAPACK for ceres | ||
Optional dependencies: | ||
* GTest for testing | ||
* Doxygen for documentation | ||
* OpenNI v1.5.4 for getting input straight from a kinect device. | ||
|
||
## Building instructions: | ||
|
||
### Linux | ||
Install NVIDIA drivers.A good tutorial with some common issues covered can be found [here]( | ||
https://askubuntu.com/a/61433/167689). | ||
|
||
Download and install CUDA from the [NVIDIA website](https://developer.nvidia.com/cuda-downloads). | ||
|
||
Install VTK, SuiteSparse, BLAS and LAPACK | ||
``` | ||
sudo apt-get install libvtk5-dev libsuitesparse-dev liblapack-dev libblas-dev | ||
``` | ||
|
||
Clone Ceres Solver `git clone https://ceres-solver.googlesource.com/ceres-solver`, then build and install using `cmake` and `make`. | ||
|
||
Clone and install opencv. The project should work with any version above 2.4.8 | ||
``` | ||
git clone https://github.com/opencv/opencv | ||
cd opencv | ||
git checkout 3.2.0 | ||
mkdir build | ||
cd build | ||
cmake .. -DWITH_VTK=ON -DBUILD_opencv_calib3d=ON BUILD_opencv_imgproc=ON | ||
make -j4 | ||
sudo make install | ||
``` | ||
Get [Boost 1.64.0](http://www.boost.org/users/download/) or above. Don't install it through apt-get as it sometimes results in linking errors on Ubuntu 16.04. | ||
|
||
Optionals: | ||
Doxygen can be installed through apt-get: `sudo apt-get install doxygen`. | ||
Clone and install [GTest](https://github.com/google/googletest) | ||
Clone and install [OpenNI](https://github.com/OpenNI/OpenNI) | ||
|
||
Now clone the repository and build: | ||
``` | ||
git clone https://github.com/mihaibujanca/dynamicfusion | ||
mkdir build | ||
cd build | ||
cmake .. | ||
make -j4 | ||
``` | ||
|
||
If you want to build the tests as well, make sure you pass `-DBUILD_TESTS=ON` to the cmake command. | ||
|
||
To build documentation, go to the project root directory and execute | ||
``` | ||
doxygen -g | ||
doxygen Doxyfile | ||
``` | ||
### Windows | ||
* [Install NVIDIA drivers](https://www.geforce.com/drivers) and [CUDA](https://developer.nvidia.com/cuda-downloads) | ||
* [Install LAPACK](http://icl.cs.utk.edu/lapack-for-windows/lapack/). | ||
* [Install VTK](http://www.vtk.org/download/) (download and build from source) | ||
* [Install OpenCV](http://docs.opencv.org/3.2.0/d3/d52/tutorial_windows_install.html). | ||
* [Install Boost](http://www.boost.org/users/download/) | ||
|
||
|
||
Optionals: | ||
* [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html) | ||
* [GTest](https://github.com/google/googletest) | ||
* [OpenNI]( http://pointclouds.org/downloads/windows.html) | ||
|
||
|
||
|
||
## Run instructions | ||
### Unix | ||
Download an example dataset using `./download_data`. | ||
To run the project, use `./build/bin/dynamicfusion <project_root>/data/umbrella` | ||
|
||
### Windows | ||
[Download the dataset](http://lgdv.cs.fau.de/uploads/publications/data/innmann2016deform/umbrella_data.zip).\ | ||
Create a `data` folder inside the project root directory. \ | ||
Unzip the archive into `data` and remove any files that are not .png. \ | ||
Inside `data`, create directories `color` and `depth`, and move color and depth frames to their corresponding folders. | ||
|
||
|
||
|
||
To use with .oni captures or straight from a kinect device, use `./build/bin/dynamicfusion_kinect <path-to-oni>` or `./build/bin/dynamicfusion_kinect <device_id>` | ||
|
||
--- | ||
Note: currently, the frame rate is too low (5-6fps) to be able to cope with live inputs, so it is advisable that you capture your input first. | ||
|
||
## References | ||
[DynamicFusion project page](http://grail.cs.washington.edu/projects/dynamicfusion/) | ||
|
||
``` | ||
@InProceedings{Newcombe_2015_CVPR, | ||
author = {Newcombe, Richard A. and Fox, Dieter and Seitz, Steven M.}, | ||
title = {DynamicFusion: Reconstruction and Tracking of Non-Rigid Scenes in Real-Time}, | ||
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)}, | ||
month = {June}, | ||
year = {2015} | ||
} | ||
``` | ||
|
||
The example dataset is taken from the [VolumeDeform project](http://lgdv.cs.fau.de/publications/publication/Pub.2016.tech.IMMD.IMMD9.volume_6/). | ||
``` | ||
@inbook{innmann2016volume, | ||
author = "Innmann, Matthias and Zollh{\"o}fer, Michael and Nie{\ss}ner, Matthias and Theobalt, Christian | ||
and Stamminger, Marc", | ||
editor = "Leibe, Bastian and Matas, Jiri and Sebe, Nicu and Welling, Max", | ||
title = "VolumeDeform: Real-Time Volumetric Non-rigid Reconstruction", | ||
bookTitle = "Computer Vision -- ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, | ||
October 11-14, 2016, Proceedings, Part VIII", | ||
year = "2016", | ||
publisher = "Springer International Publishing", | ||
address = "Cham", | ||
pages = "362--379", | ||
isbn = "978-3-319-46484-8", | ||
doi = "10.1007/978-3-319-46484-8_22", | ||
url = "http://dx.doi.org/10.1007/978-3-319-46484-8_22" | ||
} | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
############################################################################### | ||
# Find OpenNI | ||
# | ||
# This sets the following variables: | ||
# OPENNI_FOUND - True if OPENNI was found. | ||
# OPENNI_INCLUDE_DIRS - Directories containing the OPENNI include files. | ||
# OPENNI_LIBRARIES - Libraries needed to use OPENNI. | ||
# OPENNI_DEFINITIONS - Compiler flags for OPENNI. | ||
# | ||
# For libusb-1.0, add USB_10_ROOT if not found | ||
|
||
find_package(PkgConfig QUIET) | ||
|
||
# Find LibUSB | ||
if(NOT WIN32) | ||
pkg_check_modules(PC_USB_10 libusb-1.0) | ||
find_path(USB_10_INCLUDE_DIR libusb-1.0/libusb.h | ||
HINTS ${PC_USB_10_INCLUDEDIR} ${PC_USB_10_INCLUDE_DIRS} "${USB_10_ROOT}" "$ENV{USB_10_ROOT}" | ||
PATH_SUFFIXES libusb-1.0) | ||
|
||
find_library(USB_10_LIBRARY | ||
NAMES usb-1.0 | ||
HINTS ${PC_USB_10_LIBDIR} ${PC_USB_10_LIBRARY_DIRS} "${USB_10_ROOT}" "$ENV{USB_10_ROOT}" | ||
PATH_SUFFIXES lib) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(USB_10 DEFAULT_MSG USB_10_LIBRARY USB_10_INCLUDE_DIR) | ||
|
||
if(NOT USB_10_FOUND) | ||
message(STATUS "OpenNI disabled because libusb-1.0 not found.") | ||
return() | ||
else() | ||
include_directories(SYSTEM ${USB_10_INCLUDE_DIR}) | ||
endif() | ||
endif(NOT WIN32) | ||
|
||
if(${CMAKE_VERSION} VERSION_LESS 2.8.2) | ||
pkg_check_modules(PC_OPENNI openni-dev) | ||
else() | ||
pkg_check_modules(PC_OPENNI QUIET openni-dev) | ||
endif() | ||
|
||
set(OPENNI_DEFINITIONS ${PC_OPENNI_CFLAGS_OTHER}) | ||
|
||
set(OPENNI_SUFFIX) | ||
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
set(OPENNI_SUFFIX 64) | ||
endif(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
|
||
#add a hint so that it can find it without the pkg-config | ||
find_path(OPENNI_INCLUDE_DIR XnStatus.h | ||
HINTS ${PC_OPENNI_INCLUDEDIR} ${PC_OPENNI_INCLUDE_DIRS} /usr/include/openni /usr/include/ni "${OPENNI_ROOT}" "$ENV{OPENNI_ROOT}" | ||
PATHS "$ENV{OPEN_NI_INSTALL_PATH${OPENNI_SUFFIX}}/Include" | ||
PATH_SUFFIXES openni include Include) | ||
#add a hint so that it can find it without the pkg-config | ||
find_library(OPENNI_LIBRARY | ||
NAMES OpenNI${OPENNI_SUFFIX} | ||
HINTS ${PC_OPENNI_LIBDIR} ${PC_OPENNI_LIBRARY_DIRS} /usr/lib "${OPENNI_ROOT}" "$ENV{OPENNI_ROOT}" | ||
PATHS "$ENV{OPEN_NI_LIB${OPENNI_SUFFIX}}" | ||
PATH_SUFFIXES lib Lib Lib64) | ||
|
||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") | ||
set(OPENNI_LIBRARIES ${OPENNI_LIBRARY} ${LIBUSB_1_LIBRARIES}) | ||
else() | ||
set(OPENNI_LIBRARIES ${OPENNI_LIBRARY}) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(OpenNI DEFAULT_MSG OPENNI_LIBRARY OPENNI_INCLUDE_DIR) | ||
|
||
mark_as_advanced(OPENNI_LIBRARY OPENNI_INCLUDE_DIR) | ||
|
||
if(OPENNI_FOUND) | ||
# Add the include directories | ||
set(OPENNI_INCLUDE_DIRS ${OPENNI_INCLUDE_DIR}) | ||
message(STATUS "OpenNI found (include: ${OPENNI_INCLUDE_DIRS}, lib: ${OPENNI_LIBRARY})") | ||
endif(OPENNI_FOUND) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not use
REQUIRED
option, instead just check whether the dependency has been found and disable your module if it can not be built without it:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to use existing
HAVE_CUDA
variable, check the documentation at the beginning of https://github.com/opencv/opencv/blob/master/cmake/FindCUDA.cmake