Skip to content

Commit 2a43c5e

Browse files
committed
Release 1.0
0 parents commit 2a43c5e

17 files changed

+2790
-0
lines changed

.gitignore

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# GitIgnore
2+
# Non-Project Specific Files taken from https://github.com/github/gitignore
3+
4+
################
5+
# C++ Specific #
6+
################
7+
# Prerequisites
8+
*.d
9+
10+
# Compiled Object files
11+
*.slo
12+
*.lo
13+
*.o
14+
*.obj
15+
16+
# Precompiled Headers
17+
*.gch
18+
*.pch
19+
20+
# Compiled Dynamic libraries
21+
*.so
22+
*.dylib
23+
*.dll
24+
25+
# Fortran module files
26+
*.mod
27+
*.smod
28+
29+
# Compiled Static libraries
30+
*.lai
31+
*.la
32+
*.a
33+
*.lib
34+
35+
# Executables
36+
*.exe
37+
*.out
38+
*.app
39+
40+
41+
##################
42+
# macOS Specific #
43+
##################
44+
# General
45+
.DS_Store
46+
.AppleDouble
47+
.LSOverride
48+
49+
# Icon must end with two \r
50+
Icon
51+
52+
53+
# Thumbnails
54+
._*
55+
56+
# Files that might appear in the root of a volume
57+
.DocumentRevisions-V100
58+
.fseventsd
59+
.Spotlight-V100
60+
.TemporaryItems
61+
.Trashes
62+
.VolumeIcon.icns
63+
.com.apple.timemachine.donotpresent
64+
65+
# Directories potentially created on remote AFP share
66+
.AppleDB
67+
.AppleDesktop
68+
Network Trash Folder
69+
Temporary Items
70+
.apdisk
71+
72+
73+
####################
74+
# Windows Specific #
75+
####################
76+
# Windows thumbnail cache files
77+
Thumbs.db
78+
ehthumbs.db
79+
ehthumbs_vista.db
80+
81+
# Dump file
82+
*.stackdump
83+
84+
# Folder config file
85+
[Dd]esktop.ini
86+
87+
# Recycle Bin used on file shares
88+
$RECYCLE.BIN/
89+
90+
# Windows Installer files
91+
*.cab
92+
*.msi
93+
*.msm
94+
*.msp
95+
96+
# Windows shortcuts
97+
*.lnk
98+
99+
100+
######################
101+
# GNU/Linux Specific #
102+
######################
103+
*~
104+
105+
# temporary files which can be created if a process still has a handle open of a deleted file
106+
.fuse_hidden*
107+
108+
# KDE directory preferences
109+
.directory
110+
111+
# Linux trash folder which might appear on any partition or disk
112+
.Trash-*
113+
114+
# .nfs files are created when an open file is removed but is still being accessed
115+
.nfs*
116+
117+
####################
118+
# Project Specific #
119+
####################
120+
build/
121+
cmake-build-debug/
122+
data/
123+
.idea/
124+

CMakeLists.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
cmake_minimum_required(VERSION 3.0)
2+
3+
project(KinectFusionLib)
4+
5+
# Use modern C++
6+
set(CMAKE_CXX_STANDARD 14)
7+
8+
# Setting output paths
9+
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
10+
11+
# ------------------------------------------------
12+
# Dependencies
13+
# ------------------------------------------------
14+
## CUDA
15+
find_package(CUDA 8.0 REQUIRED)
16+
IF (CUDA_FOUND)
17+
include_directories("${CUDA_INCLUDE_DIRS}")
18+
# Optional: Specify the arch of your CUDA hardware here
19+
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3;-std=c++11 -gencode arch=compute_52,code=sm_52)
20+
ENDIF ()
21+
22+
## OpenCV
23+
# Optional: Set OpenCV_DIR if you want to use a custom version of OpenCV
24+
SET("OpenCV_DIR" "/opt/opencv/usr/local/share/OpenCV")
25+
find_package(OpenCV 3.0 REQUIRED)
26+
if (OpenCV_INCLUDE_DIRS)
27+
include_directories("${OpenCV_INCLUDE_DIRS}")
28+
link_directories(${OpenCV_DIR}/lib)
29+
endif (OpenCV_INCLUDE_DIRS)
30+
31+
## Eigen3
32+
find_package(Eigen3 REQUIRED)
33+
if (EIGEN3_INCLUDE_DIR)
34+
include_directories("${EIGEN3_INCLUDE_DIR}")
35+
endif (EIGEN3_INCLUDE_DIR)
36+
# ------------------------------------------------
37+
38+
SET(CUDA_PROPAGATE_HOST_FLAGS OFF)
39+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Weffc++")
40+
41+
# Targets
42+
set(PROJECT_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
43+
set(PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)
44+
45+
include_directories("${PROJECT_INCLUDE_DIR}" "${PROJECT_SOURCE_DIR}/cuda/include")
46+
file(GLOB KinectFusion_SRCS "${PROJECT_SOURCE_DIR}/cuda/*.cu" "${PROJECT_SOURCE_DIR}/*.cpp")
47+
48+
cuda_add_library(KinectFusion STATIC "${KinectFusion_SRCS}")
49+
target_link_libraries(KinectFusion "${OpenCV_LIBS}")

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Christian Diller
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
KinectFusion
2+
============
3+
4+
This is an implementation of KinectFusion, based on _Newcombe, Richard A., et al._
5+
**KinectFusion: Real-time dense surface mapping and tracking.**
6+
It makes heavy use of graphics hardware and thus allows for real-time fusion of
7+
depth image scans. Furthermore, exporting of the resulting fused volume is possible either as a pointcloud or a dense surface mesh.
8+
9+
Features
10+
--------
11+
* Real-time fusion of depth scans and corresponding RGB color images
12+
* Easy to use, modern C++14 interface
13+
* Export of the resulting volume as pointcloud
14+
* Export also as dense surface mesh using the MarchingCubes algorithm
15+
* Functions for easy export of pointclouds and meshes into the PLY file format
16+
* Retrieval of calculated camera poses for further processing
17+
18+
Dependencies
19+
------------
20+
* **GCC 5** as higher versions do not work with current nvcc (as of 2017).
21+
* **CUDA 8.0**. In order to provide real-time reconstruction, this library relies on graphics hardware.
22+
Running it exclusively on the CPU is not possible.
23+
* **OpenCV 3.0** or higher. This library heavily depends on the GPU features of OpenCV that have been refactored in the 3.0 release.
24+
Therefore, OpenCV 2 is not supported.
25+
* **Eigen3** for efficient matrix and vector operations.
26+
27+
Prerequisites
28+
-------------
29+
* Adjust CUDA architecture: Set the CUDA architecture version to that of your graphics hardware
30+
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3 -gencode arch=compute_52,code=sm_52)
31+
Tested with a nVidia GeForce 970, compute capability 5.2, Maxwell architecture
32+
* Set custom opencv path (if necessary):
33+
SET("OpenCV_DIR" "/opt/opencv/usr/local/share/OpenCV")
34+
35+
Usage
36+
-----
37+
```Cpp
38+
#include <kinectfusion.h>
39+
40+
// Define the data source
41+
XtionCamera camera {};
42+
43+
// Get a global configuration (comes with default values) and adjust some parameters
44+
kinectfusion::GlobalConfiguration configuration;
45+
configuration.voxel_scale = 2.f;
46+
configuration.init_depth = 700.f;
47+
configuration.distance_threshold = 10.f;
48+
configuration.angle_threshold = 20.f;
49+
50+
// Create a KinectFusion pipeline with the camera intrinsics and the global configuration
51+
kinectfusion::Pipeline pipeline { camera.get_parameters(), configuration };
52+
53+
// Then, just loop over the incoming frames
54+
while ( !end ) {
55+
// 1) Grab a frame from the data source
56+
InputFrame frame = camera.grab_frame();
57+
58+
// 2) Have the pipeline fuse it into the global volume
59+
bool success = pipeline.process_frame(frame.depth_map, frame.color_map);
60+
if (!success)
61+
std::cout << "Frame could not be processed" << std::endl;
62+
}
63+
64+
// Retrieve camera poses
65+
auto poses = pipeline.get_poses();
66+
67+
// Export surface mesh
68+
auto mesh = pipeline.extract_mesh();
69+
kinectfusion::export_ply("data/mesh.ply", mesh);
70+
71+
// Export pointcloud
72+
auto pointcloud = pipeline.extract_pointcloud();
73+
kinectfusion::export_ply("data/pointcloud.ply", pointcloud);
74+
```
75+
For a more in-depth example and implementations of the data sources, have a look at the [KinectFusionApp](https://github.com/chrdiller/KinectFusionApp).
76+
77+
License
78+
-------
79+
This library is licensed under MIT.

0 commit comments

Comments
 (0)