├── GPUTest
├── 1c.png
├── 1d.png
├── 2c.png
├── 2d.png
└── src
│ └── CMakeLists.txt
├── Tips.md
├── .gitignore
├── Tag_Note.md
├── GUI
└── src
│ ├── FindRealSense.cmake
│ ├── .vscode
│ ├── c_cpp_properties.json
│ └── settings.json
│ ├── Findefusion.cmake
│ ├── Main.cpp
│ ├── Tools
│ ├── CameraInterface.h
│ ├── GroundTruthOdometry.h
│ ├── RawLogReader.h
│ ├── LiveLogReader.h
│ ├── RealSenseInterface.cpp
│ ├── GroundTruthOdometry.cpp
│ ├── RealSenseInterface.h
│ ├── LogReader.h
│ ├── ThreadMutexObject.h
│ └── JPEGLoader.h
│ ├── FindOpenNI2.cmake
│ ├── CMakeLists.txt
│ ├── MainController.h
│ └── FindSuiteSparse.cmake
├── Core
└── src
│ ├── Utils
│ ├── Resolution.cpp
│ ├── Intrinsics.cpp
│ ├── WindowsExtras.h
│ ├── CholeskyDecomp.h
│ ├── WindowsExtras.cpp
│ ├── GraphNode.h
│ ├── Jacobian.h
│ ├── Img.h
│ ├── Intrinsics.h
│ ├── OrderedJacobianRow.h
│ ├── Resolution.h
│ ├── Parse.cpp
│ ├── CholeskyDecomp.cpp
│ ├── Parse.h
│ └── RGBDOdometry.h
│ ├── Defines.h
│ ├── Shaders
│ ├── empty.vert
│ ├── draw_feedback.frag
│ ├── resize.frag
│ ├── Vertex.h
│ ├── depth_norm.frag
│ ├── sample.vert
│ ├── depth_metric.frag
│ ├── visualise_textures.frag
│ ├── fill_rgb.frag
│ ├── sample.geom
│ ├── Vertex.cpp
│ ├── color.glsl
│ ├── init_unstable.vert
│ ├── index_map.frag
│ ├── draw_global_surface.frag
│ ├── data.frag
│ ├── copy_unstable.geom
│ ├── vertex_feedback.geom
│ ├── quad.geom
│ ├── depth_splat.frag
│ ├── ComputePack.h
│ ├── data.geom
│ ├── fill_normal.frag
│ ├── surfels.glsl
│ ├── fill_vertex.frag
│ ├── draw_feedback.vert
│ ├── draw_global_surface.vert
│ ├── combo_splat.frag
│ ├── FillIn.h
│ ├── index_map.vert
│ ├── vertex_feedback.vert
│ ├── draw_global_surface_phong.frag
│ ├── ComputePack.cpp
│ ├── FeedbackBuffer.h
│ ├── depth_bilateral.frag
│ ├── geometry.glsl
│ ├── update.vert
│ ├── Resize.h
│ ├── splat.vert
│ ├── fxaa.frag
│ ├── draw_global_surface.geom
│ └── Uniform.h
│ ├── PoseMatch.h
│ ├── CudaComputeTargetFlags.cmake
│ ├── GPUTexture.cpp
│ ├── GPUTexture.h
│ ├── Cuda
│ ├── convenience.cuh
│ ├── containers
│ │ ├── device_memory_impl.hpp
│ │ └── kernel_containers.hpp
│ └── operators.cuh
│ ├── CMakeLists.txt
│ ├── Deformation.h
│ └── FindSuiteSparse.cmake
├── .VSCodeCounter
└── results.md
└── .vscode
└── settings.json
/GPUTest/1c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DreamWaterFound/ElasticFusion-annotation/HEAD/GPUTest/1c.png
--------------------------------------------------------------------------------
/GPUTest/1d.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DreamWaterFound/ElasticFusion-annotation/HEAD/GPUTest/1d.png
--------------------------------------------------------------------------------
/GPUTest/2c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DreamWaterFound/ElasticFusion-annotation/HEAD/GPUTest/2c.png
--------------------------------------------------------------------------------
/GPUTest/2d.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DreamWaterFound/ElasticFusion-annotation/HEAD/GPUTest/2d.png
--------------------------------------------------------------------------------
/Tips.md:
--------------------------------------------------------------------------------
1 | 使用CUDA 10.
2 |
3 | NVCC的编译选项仅编译了计算能力6.1。有需要可以在CMakeLists.txt中进行相应的改动
4 |
5 | 不过CUDA10中有些特性已经被deprecated,方便起见屏蔽警告。
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | deps/
3 | .project
4 | .cproject
5 | *.user
6 | **/.VSCodeCounter/**
7 | **/sourcetrail/**
8 | GUI/*.freiburg
9 | GUI/*.ply
10 |
--------------------------------------------------------------------------------
/Tag_Note.md:
--------------------------------------------------------------------------------
1 | # Tag Note
2 |
3 | 主要用来备忘, 模块计时模块中的字符串描述符都对应的是什么过程.
4 |
5 | - LogRead 从记录文件中读取一张图像的时间
6 | - Run 执行eFusion->processFrame()一次(也就是送一帧图像, 进行处理所耗费的时间)
7 | - GUI 绘制GUI界面, 更新各种模型所耗费的时间
8 | - Global 绘制 global model 所耗费的时间
9 |
10 |
11 |
--------------------------------------------------------------------------------
/GUI/src/FindRealSense.cmake:
--------------------------------------------------------------------------------
1 | set(REALSENSE_ROOT "/usr/local" CACHE PATH "Root directory of libREALSENSE")
2 |
3 | FIND_PATH(REALSENSE_INCLUDE_DIR libREALSENSE HINTS "${REALSENSE_ROOT}/include")
4 | FIND_LIBRARY(REALSENSE_LIBRARY REALSENSE HINTS "${REALSENSE_ROOT}/bin/x64" "${REALSENSE_ROOT}/lib")
5 |
6 | find_package_handle_standard_args(REALSENSE DEFAULT_MSG REALSENSE_LIBRARY REALSENSE_INCLUDE_DIR)
7 |
8 | mark_as_advanced(REALSENSE_LIBRARY REALSENSE_INCLUDE_DIR)
9 |
10 |
--------------------------------------------------------------------------------
/Core/src/Utils/Resolution.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file Resolution.cpp
3 | * @author guoqing (1337841346@qq.com)
4 | * @brief 分辨率对象的功能实现
5 | * @version 0.1
6 | * @date 2020-01-03
7 | *
8 | * @copyright Copyright (c) 2020
9 | *
10 | */
11 |
12 | /*
13 | * This file was written for porting ElasticFusion to windows
14 | * by Filip Srajer (filip.srajer@inf.ethz.ch).
15 | *
16 | */
17 |
18 | #include "Resolution.h"
19 |
20 | // 获取给定分辨率的分辨率对象实例
21 | const Resolution & Resolution::getInstance(int width,int height)
22 | {
23 | static const Resolution instance(width,height);
24 | return instance;
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/Core/src/Utils/Intrinsics.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file Intrinsics.cpp
3 | * @author guoqing (1337841346@qq.com)
4 | * @brief 相机内参类对象的实现
5 | * @version 0.1
6 | * @date 2020-01-03
7 | *
8 | * @copyright Copyright (c) 2020
9 | *
10 | */
11 |
12 | /*
13 | * This file was written for porting ElasticFusion to windows
14 | * by Filip Srajer (filip.srajer@inf.ethz.ch).
15 | *
16 | */
17 |
18 | #include "Intrinsics.h"
19 |
20 | // 使用给定内参生成内参类对象
21 | const Intrinsics & Intrinsics::getInstance(float fx,float fy,float cx,float cy)
22 | {
23 | static const Intrinsics instance(fx,fy,cx,cy);
24 | return instance;
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/Core/src/Utils/WindowsExtras.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file WindowsExtras.h
3 | * @author guoqing (1337841346@qq.com)
4 | * @brief 由于 windows 下没有Windows下的一些函数, 所以这里撰写了用于 windows 下工作的同名替代函数
5 | * @version 0.1
6 | * @date 2020-01-07
7 | *
8 | * @copyright Copyright (c) 2020
9 | *
10 | */
11 |
12 | /*
13 | * This file was written for porting ElasticFusion to windows
14 | * by Filip Srajer (filip.srajer@inf.ethz.ch).
15 | *
16 | */
17 |
18 | #pragma once
19 |
20 | #include "../Defines.h"
21 |
22 | #ifdef WIN32
23 |
24 | EFUSION_API int gettimeofday(struct timeval * tp,struct timezone * tzp);
25 |
26 | EFUSION_API void *mempcpy(void *dest,const void *src,size_t n);
27 |
28 | #endif // WIN32
--------------------------------------------------------------------------------
/Core/src/Defines.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file Defines.h
3 | * @author guoqing (1337841346@qq.com)
4 | * @brief 一些定义
5 | * @version 0.1
6 | * @date 2020-01-06
7 | *
8 | * @copyright Copyright (c) 2020
9 | *
10 | */
11 |
12 | /*
13 | * This file was written for porting ElasticFusion to windows
14 | * by Filip Srajer (filip.srajer@inf.ethz.ch).
15 | *
16 | */
17 |
18 | #pragma once
19 |
20 | #ifndef WIN32
21 | // Linux 下就没有这么多事情
22 | # define EFUSION_API
23 | #else
24 | // windows 下编译的 *.dll 文件有权限限制, 外部程序如果想使用 dll 中的内容, 它自己需要 dllimport(其实不用也可以);
25 | // 同样我们必须需要给暴露给外部程序的函数前面添加这个 dllexport
26 | // ref:[https://blog.csdn.net/huangyimo/article/details/81748939]
27 | # ifdef efusion_EXPORTS
28 | # define EFUSION_API __declspec(dllexport)
29 | # else
30 | # define EFUSION_API __declspec(dllimport)
31 | # endif
32 | #endif
33 |
--------------------------------------------------------------------------------
/GUI/src/.vscode/c_cpp_properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Linux",
5 | "includePath": [
6 | "${workspaceFolder}/**",
7 | "${workspaceFolder}/../../Core/src",
8 | "${workspaceFolder}/tools",
9 | "/home/guoqing/libraries/Pangolin_ElasticFusion/include",
10 | "/usr/include/openni2",
11 | "/usr/local/cuda-10.0/include",
12 | "/home/guoqing/libraries/eigen_333/include/eigen3"
13 | ],
14 | "defines": ["USE_OPENNI_PANGOLIN"],
15 | "compilerPath": "/usr/bin/gcc",
16 | "cStandard": "c11",
17 | "cppStandard": "c++17",
18 | "intelliSenseMode": "clang-x64"
19 | }
20 | ],
21 | "version": 4
22 | }
23 |
--------------------------------------------------------------------------------
/Core/src/Shaders/empty.vert:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330
20 |
21 | void main()
22 | {
23 | }
24 |
--------------------------------------------------------------------------------
/Core/src/Shaders/draw_feedback.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | in vec4 vColor;
22 |
23 | out vec4 FragColor;
24 |
25 | void main()
26 | {
27 | FragColor = vColor;
28 | }
29 |
--------------------------------------------------------------------------------
/Core/src/Shaders/resize.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | in vec2 texcoord;
22 |
23 | out vec4 FragColor;
24 |
25 | uniform sampler2D eSampler;
26 |
27 | void main()
28 | {
29 | FragColor = texture2D(eSampler, texcoord.xy);
30 | }
31 |
--------------------------------------------------------------------------------
/Core/src/Shaders/Vertex.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #ifndef VERTEX_H_
20 | #define VERTEX_H_
21 |
22 | #include
23 |
24 | #include "../Defines.h"
25 |
26 | class Vertex
27 | {
28 | public:
29 | EFUSION_API static const int SIZE;
30 |
31 | private:
32 | Vertex(){}
33 | };
34 |
35 |
36 | #endif /* VERTEX_H_ */
37 |
--------------------------------------------------------------------------------
/GUI/src/Findefusion.cmake:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Find efusion
3 | #
4 | # This sets the following variables:
5 | # EFUSION_FOUND - True if EFUSION was found.
6 | # EFUSION_INCLUDE_DIRS - Directories containing the EFUSION include files.
7 | # EFUSION_LIBRARIES - Libraries needed to use EFUSION.
8 |
9 | find_path(EFUSION_INCLUDE_DIR ElasticFusion.h
10 | PATHS
11 | ${CMAKE_CURRENT_SOURCE_DIR}/../../Core/src
12 | PATH_SUFFIXES Core
13 | )
14 |
15 | find_library(EFUSION_LIBRARY
16 | NAMES libefusion.so
17 | PATHS
18 | ${CMAKE_CURRENT_SOURCE_DIR}/../../Core/build
19 | ${CMAKE_CURRENT_SOURCE_DIR}/../../Core/src/build
20 | PATH_SUFFIXES ${EFUSION_PATH_SUFFIXES}
21 | )
22 |
23 | set(EFUSION_INCLUDE_DIRS ${EFUSION_INCLUDE_DIR})
24 | set(EFUSION_LIBRARIES ${EFUSION_LIBRARY})
25 |
26 | include(FindPackageHandleStandardArgs)
27 | find_package_handle_standard_args(EFUSION DEFAULT_MSG EFUSION_LIBRARY EFUSION_INCLUDE_DIR)
28 |
29 | if(NOT WIN32)
30 | mark_as_advanced(EFUSION_LIBRARY EFUSION_INCLUDE_DIR)
31 | endif()
32 |
--------------------------------------------------------------------------------
/GPUTest/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.6.0)
2 |
3 | project(GPUTest)
4 |
5 | find_package(Pangolin 0.1 REQUIRED)
6 | find_package(CUDA REQUIRED)
7 |
8 | set(efusion_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../Core/src" CACHE PATH "Where ElasticFusion.h lives")
9 | set(efusion_LIBRARY "${CMAKE_CURRENT_SOURCE_DIR}/../../Core/build/libefusion.so" CACHE FILEPATH "Where libefusion.so lives")
10 |
11 | include_directories(/usr/include/suitesparse)
12 | include_directories(${CUDA_INCLUDE_DIRS})
13 | include_directories(${EIGEN_INCLUDE_DIRS})
14 | include_directories(${Pangolin_INCLUDE_DIRS})
15 | include_directories(${efusion_INCLUDE_DIR})
16 |
17 | file(GLOB srcs *.cpp)
18 |
19 | set(CMAKE_CXX_FLAGS "-O3 -msse2 -msse3 -Wall -std=c++11")
20 | #set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -g -Wall")
21 |
22 | add_executable(GPUTest
23 | ${srcs}
24 | )
25 |
26 | target_link_libraries(GPUTest
27 | ${efusion_LIBRARY}
28 | ${Eigen_LIBRARIES}
29 | ${Pangolin_LIBRARIES}
30 | ${CUDA_LIBRARIES}
31 | ${SUITESPARSE_LIBRARIES}
32 | )
33 |
34 |
--------------------------------------------------------------------------------
/Core/src/Shaders/depth_norm.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | in vec2 texcoord;
22 |
23 | out float FragColor;
24 |
25 | uniform usampler2D gSampler;
26 | uniform float minVal;
27 | uniform float maxVal;
28 |
29 | void main()
30 | {
31 | uint value = uint(texture(gSampler, texcoord.xy));
32 | if(value > uint(minVal) && value < uint(maxVal))
33 | FragColor = 1.0f - (value / maxVal);
34 | else
35 | FragColor = 0;
36 | }
37 |
--------------------------------------------------------------------------------
/Core/src/Shaders/sample.vert:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | layout (location = 0) in vec4 vPosition;
22 | layout (location = 1) in vec4 vColorTime;
23 | layout (location = 2) in vec4 vNormRad;
24 |
25 | out vec4 vPosition0;
26 | out vec4 vColorTime0;
27 | out vec4 vNormRad0;
28 | flat out int id;
29 |
30 | void main()
31 | {
32 | vPosition0 = vPosition;
33 | vColorTime0 = vColorTime;
34 | vNormRad0 = vNormRad;
35 | id = gl_VertexID;
36 | }
37 |
--------------------------------------------------------------------------------
/Core/src/Shaders/depth_metric.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | in vec2 texcoord;
22 |
23 | out float FragColor;
24 |
25 | uniform usampler2D gSampler;
26 | uniform float maxD;
27 |
28 | void main()
29 | {
30 | uint value = uint(texture(gSampler, texcoord.xy));
31 |
32 | if(value > uint(maxD * 1000.0f) || value < 300U)
33 | {
34 | FragColor = 0U;
35 | }
36 | else
37 | {
38 | FragColor = float(value) / 1000.0f;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Core/src/Shaders/visualise_textures.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | uniform sampler2D texVerts;
22 | uniform float maxDepth;
23 |
24 | in vec2 texcoord;
25 |
26 | out vec4 FragColor;
27 |
28 | void main()
29 | {
30 | vec4 vertex = texture2D(texVerts, texcoord);
31 |
32 | if(vertex.z > maxDepth || vertex.z <= 0)
33 | {
34 | discard;
35 | }
36 | else
37 | {
38 | FragColor = 1.0f - vec4(vertex.z / maxDepth);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Core/src/Shaders/fill_rgb.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | in vec2 texcoord;
22 |
23 | out vec4 FragColor;
24 |
25 | uniform sampler2D eSampler;
26 | uniform sampler2D rSampler;
27 | uniform int passthrough;
28 |
29 | void main()
30 | {
31 | vec4 sample = texture2D(eSampler, texcoord.xy);
32 |
33 | if(sample.x + sample.y + sample.z == 0 || passthrough == 1)
34 | FragColor = texture2D(rSampler, texcoord.xy);
35 | else
36 | FragColor = sample;
37 | }
38 |
--------------------------------------------------------------------------------
/Core/src/Shaders/sample.geom:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | layout(points) in;
22 | layout(points, max_vertices = 1) out;
23 |
24 | in vec4 vPosition0[];
25 | in vec4 vColorTime0[];
26 | in vec4 vNormRad0[];
27 | flat in int id[];
28 |
29 | out vec4 vData;
30 |
31 | void main()
32 | {
33 | if(id[0] % 5000 == 0)
34 | {
35 | vData.xyz = vPosition0[0].xyz;
36 | vData.w = vColorTime0[0].z;
37 | EmitVertex();
38 | EndPrimitive();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Core/src/Shaders/Vertex.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #include "Vertex.h"
20 |
21 | /*
22 | * OK this is the structure
23 | *
24 | *--------------------
25 | * vec3 position
26 | * float confidence
27 | *
28 | * float color (encoded as a 24-bit integer)
29 | * float
30 | * float initTime
31 | * float timestamp
32 | *
33 | * vec3 normal
34 | * float radius
35 | *--------------------
36 |
37 | * Which is three vec4s
38 | */
39 |
40 | const int Vertex::SIZE = sizeof(Eigen::Vector4f) * 3;
41 |
--------------------------------------------------------------------------------
/Core/src/Shaders/color.glsl:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | float encodeColor(vec3 c)
20 | {
21 | int rgb = int(round(c.x * 255.0f));
22 | rgb = (rgb << 8) + int(round(c.y * 255.0f));
23 | rgb = (rgb << 8) + int(round(c.z * 255.0f));
24 | return float(rgb);
25 | }
26 |
27 | vec3 decodeColor(float c)
28 | {
29 | vec3 col;
30 | col.x = float(int(c) >> 16 & 0xFF) / 255.0f;
31 | col.y = float(int(c) >> 8 & 0xFF) / 255.0f;
32 | col.z = float(int(c) & 0xFF) / 255.0f;
33 | return col;
34 | }
35 |
--------------------------------------------------------------------------------
/GUI/src/Main.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file Main.cpp
3 | * @author guoqing (1337841346@qq.com)
4 | * @brief GUI 界面启动器
5 | * @version 0.1
6 | * @date 2020-01-03
7 | *
8 | * @copyright Copyright (c) 2020
9 | *
10 | */
11 |
12 | /*
13 | * This file is part of ElasticFusion.
14 | *
15 | * Copyright (C) 2015 Imperial College London
16 | *
17 | * The use of the code within this file and all code within files that
18 | * make up the software that is ElasticFusion is permitted for
19 | * non-commercial purposes only. The full terms and conditions that
20 | * apply to the code within this file are detailed within the LICENSE.txt
21 | * file and at
22 | * unless explicitly stated. By downloading this file you agree to
23 | * comply with these terms.
24 | *
25 | * If you wish to use any of this code for commercial purposes then
26 | * please email researchcontracts.engineering@imperial.ac.uk.
27 | *
28 | */
29 |
30 |
31 | #include "MainController.h"
32 |
33 | // 说是主要文件, 但是主要的内容还都是在 MainController 这个类中实现的
34 | int main(int argc, char * argv[])
35 | {
36 | MainController mainController(argc, argv);
37 |
38 | mainController.launch();
39 |
40 | return 0;
41 | }
42 |
--------------------------------------------------------------------------------
/Core/src/Shaders/init_unstable.vert:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | layout (location = 0) in vec4 vPosition;
22 | layout (location = 1) in vec4 vColor;
23 | layout (location = 2) in vec4 vNormRad;
24 |
25 | out vec4 vPosition0;
26 | out vec4 vColor0;
27 | out vec4 vNormRad0;
28 |
29 | void main()
30 | {
31 | vPosition0 = vPosition;
32 | vColor0 = vColor;
33 | vColor0.y = 0; //Unused
34 | vColor0.z = 1; //This sets the vertex's initialisation time
35 | vNormRad0 = vNormRad;
36 | }
37 |
--------------------------------------------------------------------------------
/Core/src/Shaders/index_map.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | in vec4 vPosition0;
22 | in vec4 vColorTime0;
23 | in vec4 vNormRad0;
24 | flat in int vertexId;
25 |
26 | layout(location = 0) out int FragColor;
27 | layout(location = 1) out vec4 vPosition1;
28 | layout(location = 2) out vec4 vColorTime1;
29 | layout(location = 3) out vec4 vNormRad1;
30 |
31 | void main()
32 | {
33 | vPosition1 = vPosition0;
34 | vColorTime1 = vColorTime0;
35 | vNormRad1 = vNormRad0;
36 | FragColor = vertexId;
37 | }
38 |
--------------------------------------------------------------------------------
/Core/src/Shaders/draw_global_surface.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | in vec3 vColor0;
22 | in vec2 texcoord;
23 | in float radius;
24 | flat in int unstablePoint;
25 |
26 | out vec4 FragColor;
27 |
28 | void main()
29 | {
30 | if(dot(texcoord, texcoord) > 1.0)
31 | discard;
32 |
33 | FragColor = vec4(vColor0, 1.0f);
34 |
35 | if(unstablePoint == 1)
36 | {
37 | gl_FragDepth = gl_FragCoord.z + radius;
38 | }
39 | else
40 | {
41 | gl_FragDepth = gl_FragCoord.z;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Core/src/Shaders/data.frag:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | in vec4 vPosition0;
22 | in vec4 vColor0;
23 | in vec4 vNormRad0;
24 | flat in int updateId0;
25 |
26 | layout(location = 0) out vec4 vPosition1;
27 | layout(location = 1) out vec4 vColor1;
28 | layout(location = 2) out vec4 vNormRad1;
29 |
30 | void main()
31 | {
32 | //If we have a point to update in the existing model, store that
33 | if(updateId0 == 1)
34 | {
35 | vPosition1 = vPosition0;
36 | vColor1 = vColor0;
37 | vNormRad1 = vNormRad0;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Core/src/Shaders/copy_unstable.geom:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | layout(points) in;
22 | layout(points, max_vertices = 1) out;
23 |
24 | in vec4 vPosition[];
25 | in vec4 vColor[];
26 | in vec4 vNormRad[];
27 | flat in int test[];
28 |
29 | out vec4 vPosition0;
30 | out vec4 vColor0;
31 | out vec4 vNormRad0;
32 |
33 | void main()
34 | {
35 | if(test[0] > 0)
36 | {
37 | vPosition0 = vPosition[0];
38 | vColor0 = vColor[0];
39 | vNormRad0 = vNormRad[0];
40 | EmitVertex();
41 | EndPrimitive();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Core/src/Shaders/vertex_feedback.geom:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | layout(points) in;
22 | layout(points, max_vertices = 1) out;
23 |
24 | in vec4 vPosition[];
25 | in vec4 vColor[];
26 | in vec4 vNormRad[];
27 | in float zVal[];
28 |
29 | out vec4 vPosition0;
30 | out vec4 vColor0;
31 | out vec4 vNormRad0;
32 |
33 | void main()
34 | {
35 | if(zVal[0] > 0)
36 | {
37 | vPosition0 = vPosition[0];
38 | vColor0 = vColor[0];
39 | vNormRad0 = vNormRad[0];
40 | EmitVertex();
41 | EndPrimitive();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/.VSCodeCounter/results.md:
--------------------------------------------------------------------------------
1 | # Summary
2 |
3 | Date : 2019-12-30 11:23:43
4 |
5 | Directory /home/guoqing/SLAM/ElasticFusion/ElasticFusion-run
6 |
7 | Total : 89 files, 11200 codes, 2014 comments, 3350 blanks, all 16564 lines
8 |
9 | [details](details.md)
10 |
11 | ## Languages
12 | | language | files | code | comment | blank | total |
13 | | :--- | ---: | ---: | ---: | ---: | ---: |
14 | | C++ | 32 | 5,660 | 905 | 1,790 | 8,355 |
15 | | CUDA C++ | 46 | 4,253 | 1,104 | 1,357 | 6,714 |
16 | | CMake | 8 | 1,093 | 0 | 136 | 1,229 |
17 | | Markdown | 2 | 141 | 0 | 60 | 201 |
18 | | Shell Script | 1 | 53 | 5 | 7 | 65 |
19 |
20 | ## Directories
21 | | path | files | code | comment | blank | total |
22 | | :--- | ---: | ---: | ---: | ---: | ---: |
23 | | . | 89 | 11,200 | 2,014 | 3,350 | 16,564 |
24 | | Core | 61 | 7,795 | 1,727 | 2,473 | 11,995 |
25 | | Core/src | 61 | 7,795 | 1,727 | 2,473 | 11,995 |
26 | | Core/src/Cuda | 12 | 2,006 | 747 | 673 | 3,426 |
27 | | Core/src/Cuda/containers | 6 | 444 | 430 | 205 | 1,079 |
28 | | Core/src/Shaders | 12 | 640 | 222 | 257 | 1,119 |
29 | | Core/src/Utils | 21 | 2,235 | 357 | 689 | 3,281 |
30 | | GPUTest | 1 | 234 | 17 | 83 | 334 |
31 | | GPUTest/src | 1 | 234 | 17 | 83 | 334 |
32 | | GUI | 24 | 2,977 | 265 | 727 | 3,969 |
33 | | GUI/src | 24 | 2,977 | 265 | 727 | 3,969 |
34 | | GUI/src/Tools | 15 | 1,523 | 214 | 485 | 2,222 |
35 |
36 | [details](details.md)
--------------------------------------------------------------------------------
/Core/src/Utils/CholeskyDecomp.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #ifndef UTILS_CHOLESKYDECOMP_H_
20 | #define UTILS_CHOLESKYDECOMP_H_
21 |
22 | #include
23 | #include
24 |
25 | #include "Jacobian.h"
26 |
27 | class CholeskyDecomp
28 | {
29 | public:
30 | CholeskyDecomp();
31 | virtual ~CholeskyDecomp();
32 |
33 | void freeFactor();
34 |
35 | Eigen::VectorXd solve(const Jacobian & jacobian, const Eigen::VectorXd & residual, const bool firstRun);
36 |
37 | private:
38 | cholmod_common Common;
39 | cholmod_factor * L;
40 | };
41 |
42 | #endif /* UTILS_CHOLESKYDECOMP_H_ */
43 |
--------------------------------------------------------------------------------
/Core/src/Utils/WindowsExtras.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * @file WindowsExtras.cpp
3 | * @author guoqing (1337841346@qq.com)
4 | * @brief 由于 windows 下没有Windows下的一些函数, 所以这里撰写了用于 windows 下工作的同名替代函数
5 | * @version 0.1
6 | * @date 2020-01-07
7 | *
8 | * @copyright Copyright (c) 2020
9 | *
10 | */
11 |
12 | /*
13 | * This file was written for porting ElasticFusion to windows
14 | * by Filip Srajer (filip.srajer@inf.ethz.ch).
15 | *
16 | */
17 |
18 | #include "WindowsExtras.h"
19 |
20 | #ifdef WIN32
21 |
22 | #include
23 | #include
24 | #define far
25 | #include
26 | #include
27 |
28 | int gettimeofday(struct timeval * tp,struct timezone * tzp)
29 | {
30 | // Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's
31 | static const uint64_t EPOCH = ((uint64_t)116444736000000000ULL);
32 |
33 | SYSTEMTIME system_time;
34 | FILETIME file_time;
35 | uint64_t time;
36 |
37 | GetSystemTime(&system_time);
38 | SystemTimeToFileTime(&system_time,&file_time);
39 | time = ((uint64_t)file_time.dwLowDateTime);
40 | time += ((uint64_t)file_time.dwHighDateTime) << 32;
41 |
42 | tp->tv_sec = (long)((time - EPOCH) / 10000000L);
43 | tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
44 | return 0;
45 | }
46 |
47 | void *mempcpy(void *dest,const void *src,size_t n)
48 | {
49 | return (char *)memcpy(dest,src,n) + n;
50 | }
51 |
52 | #endif // WIN32
--------------------------------------------------------------------------------
/Core/src/Shaders/quad.geom:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ElasticFusion.
3 | *
4 | * Copyright (C) 2015 Imperial College London
5 | *
6 | * The use of the code within this file and all code within files that
7 | * make up the software that is ElasticFusion is permitted for
8 | * non-commercial purposes only. The full terms and conditions that
9 | * apply to the code within this file are detailed within the LICENSE.txt
10 | * file and at
11 | * unless explicitly stated. By downloading this file you agree to
12 | * comply with these terms.
13 | *
14 | * If you wish to use any of this code for commercial purposes then
15 | * please email researchcontracts.engineering@imperial.ac.uk.
16 | *
17 | */
18 |
19 | #version 330 core
20 |
21 | layout(points) in;
22 | layout(triangle_strip, max_vertices = 4) out;
23 |
24 | out vec2 texcoord;
25 |
26 | void main()
27 | {
28 | gl_Position = vec4(1.0, 1.0, 0.0, 1.0);
29 | texcoord = vec2(1.0, 1.0);
30 | EmitVertex();
31 |
32 | gl_Position = vec4(-1.0, 1.0, 0.0, 1.0);
33 | texcoord = vec2(0.0, 1.0);
34 | EmitVertex();
35 |
36 | gl_Position = vec4(1.0,-1.0, 0.0, 1.0);
37 | texcoord = vec2(1.0, 0.0);
38 | EmitVertex();
39 |
40 | gl_Position = vec4(-1.0,-1.0, 0.0, 1.0);
41 | texcoord = vec2(0.0, 0.0);
42 | EmitVertex();
43 |
44 | EndPrimitive();
45 | }
46 |
--------------------------------------------------------------------------------
/GUI/src/Tools/CameraInterface.h:
--------------------------------------------------------------------------------
1 | /**
2 | * @file CameraInterface.h
3 | * @author guoqing (1337841346@qq.com)
4 | * @brief 相机接口虚基类
5 | * @version 0.1
6 | * @date 2020-01-04
7 | *
8 | * @copyright Copyright (c) 2020
9 | *
10 | */
11 |
12 | #pragma once
13 |
14 | // STL
15 | #include
16 | #include
17 | #include
18 | #include