Skip to content

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

Open
wants to merge 6 commits into
base: 4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 58 additions & 75 deletions modules/dynamicfusion/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,82 +1,65 @@
cmake_minimum_required(VERSION 3.5.0)

# ---[ Configurations types
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Possible configurations" FORCE)
set(the_description "Non-rigid 3D reconstruction")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -DFORCE_INLINERS -D_MWAITXINTRIN_H_INCLUDED")
if (DEFINED CMAKE_BUILD_TYPE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES})
endif()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
find_package(Doxygen)
if(DOXYGEN_FOUND)

set(DOXYGEN_INPUT ${SOURCE_FILES})
set(DOXYGEN_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

add_custom_command(
OUTPUT ${DOXYGEN_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E echo_append "Building API Documentation..."
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT}
COMMAND ${CMAKE_COMMAND} -E echo "Done."
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${DOXYGEN_INPUT}
)

add_custom_target(apidoc ALL DEPENDS ${DOXYGEN_OUTPUT})

add_custom_target(apidoc_forced
COMMAND ${CMAKE_COMMAND} -E echo_append "Building API Documentation..."
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT}
COMMAND ${CMAKE_COMMAND} -E echo "Done."
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

endif(DOXYGEN_FOUND)
endif()

# ---[ Solution name
project(kfusion C CXX)

# ---[ utility
#
## ---[ 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(OpenCV REQUIRED COMPONENTS core viz highgui calib3d)
#include(cmake/Targets.cmake)
#
## ---[ find dependencies
find_package(CUDA REQUIRED)
Copy link
Contributor

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:

find_package(Ceres QUIET)
if (NOT Ceres_FOUND)
    message(STATUS "${module} has been disabled because Ceres library has not been found")
    ocv_module_disable(${module})
endif()

Copy link
Contributor

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

find_package(OpenNI)
#find_package(OpenNI)
find_package(Ceres REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS} ${CERES_INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${CUDA_INCLUDE_DIRS} ${OPENNI_INCLUDE_DIR} "kfusion/src/utils" "kfusion/include/nanoflann")
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)

add_subdirectory(kfusion)
add_subdirectory(apps)
include_directories(${CERES_INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${CUDA_INCLUDE_DIRS} ${OPENNI_INCLUDE_DIR} "kfusion/src/utils" "kfusion/include/nanoflann")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use existing flann module instead of nanoflann?

Copy link
Author

Choose a reason for hiding this comment

The 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)
Copy link
Contributor

Choose a reason for hiding this comment

The 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any #include "opencv2/calib3d.hpp" in your code, it means that you don't need the dependency on opencv_calib3d module. Same for opencv_highgui.

Note that all samples will receive dependency on imgcodecs, videoio and highgui automatically, so you don't need to add them to your module.


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()
ocv_warnings_disable(CMAKE_CXX_FLAGS
-Wundef
-Wshadow
-Wsign-compare
-Wmissing-declarations
-Wunused-but-set-variable
-Wunused-parameter
-Wunused-function
)
25 changes: 0 additions & 25 deletions modules/dynamicfusion/apps/CMakeLists.txt

This file was deleted.

158 changes: 0 additions & 158 deletions modules/dynamicfusion/apps/dynamicfusion_kinect.cpp

This file was deleted.

23 changes: 23 additions & 0 deletions modules/dynamicfusion/doc/dynamicfusion.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@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}
}

@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"
}
5 changes: 5 additions & 0 deletions modules/dynamicfusion/include/opencv2/dynamicfusion.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifndef OPENCV_DYNAMICFUSION_HPP
#define OPENCV_DYNAMICFUSION_HPP
#include <opencv2/kfusion/kinfu.hpp>
#include <opencv2/kfusion/cuda/tsdf_volume.hpp>
#endif //OPENCV_DYNAMICFUSION_HPP
Loading