Skip to content

Commit b53777f

Browse files
author
swayfreeda
committed
first time
1 parent b1b4ace commit b53777f

File tree

188 files changed

+38513
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+38513
-0
lines changed

.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/ImageBasedModellingEduV1.0.iml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/Project.xml

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
project(ImageBasedModellingEdu)
3+
4+
set(CMAKE_CXX_STANDARD 11)
5+
set(CMAKE_CXX_FLAGS "-fPIC")
6+
7+
add_subdirectory(core)
8+
#add_subdirectory(math)
9+
add_subdirectory(util)
10+
add_subdirectory(features)
11+
add_subdirectory(sfm)
12+
add_subdirectory(examples)

core/CMakeLists.txt

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
project(core)
2+
set(CMAKE_CXX_STANDARD 11)
3+
set(CMAKE_CXX_FLAGS "-fPIC")
4+
5+
6+
# find linpng
7+
find_package(PNG REQUIRED)
8+
if(PNG_FOUND)
9+
message("PNG found: ${PNG_LIBRARIES}")
10+
include_directories(${PNG_INCLUDE_DIRS})
11+
add_definitions(${PNG_DEFINITIONS})
12+
endif()
13+
14+
# find libjpeg
15+
find_package(JPEG REQUIRED)
16+
if(JPEG_FOUND)
17+
message("JPEG found: ${JPEG_LIBRARIES}")
18+
include_directories(${JPEG_INCLUDE_DIR})
19+
endif()
20+
21+
# find libtiff
22+
find_package(TIFF REQUIRED)
23+
if(TIFF_FOUND)
24+
message("TIFF found: ${TIFF_LIBRARIES}")
25+
include_directories(${TIFF_INCLUDE_DIR})
26+
endif()
27+
28+
include_directories("..")
29+
set(HEADERS
30+
defines.h
31+
bundle.h
32+
bundle_io.h
33+
camera.h
34+
image.h
35+
image_base.h
36+
image_color.h
37+
image_drawing.h
38+
image_exif.h
39+
image_io.h
40+
image_tools.h
41+
scene.h
42+
view.h
43+
)
44+
45+
set(SOURCE_FILES
46+
bundle.cc
47+
bundle_io.cc
48+
camera.cc
49+
image_exif.cc
50+
image_io.cc
51+
image_tools.cc
52+
scene.cc
53+
view.cc
54+
)
55+
add_library(core ${HEADERS} ${SOURCE_FILES})
56+
target_link_libraries(core util ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES})
57+

core/Makefile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
MVE_ROOT := ../..
2+
TARGET := libmve.a
3+
include ${MVE_ROOT}/Makefile.inc
4+
5+
# Position independent code (-fPIC) is required for the UMVE plugin system.
6+
CXXFLAGS += -fPIC -I${MVE_ROOT}/libs
7+
LDLIBS += -lpng -ltiff -ljpeg
8+
9+
SOURCES := $(wildcard [^_]*.cc)
10+
${TARGET}: ${SOURCES:.cc=.o}
11+
$(AR) rcs $@ $^
12+
13+
_test%: _test%.o libmve.a libmve_util.a
14+
${LINK.cc} -o $@ $^ ${LDLIBS}
15+
16+
clean:
17+
${RM} ${TARGET} *.o Makefile.dep
18+
19+
.PHONY: clean

core/Makefile.dep

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
bundle.o: bundle.cc ../../libs/mve/bundle.h ../../libs/mve/camera.h \
2+
../../libs/mve/defines.h ../../libs/mve/mesh.h \
3+
../../libs/math/vector.h ../../libs/math/defines.h \
4+
../../libs/math/algo.h
5+
bundle_io.o: bundle_io.cc ../../libs/util/file_system.h \
6+
../../libs/util/defines.h ../../libs/util/strings.h \
7+
../../libs/util/exception.h ../../libs/math/matrix.h \
8+
../../libs/math/defines.h ../../libs/math/algo.h \
9+
../../libs/math/vector.h ../../libs/mve/bundle_io.h \
10+
../../libs/mve/bundle.h ../../libs/mve/camera.h \
11+
../../libs/mve/defines.h ../../libs/mve/mesh.h
12+
camera.o: camera.cc ../../libs/math/matrix_tools.h \
13+
../../libs/math/defines.h ../../libs/math/matrix.h \
14+
../../libs/math/algo.h ../../libs/math/vector.h \
15+
../../libs/mve/camera.h ../../libs/mve/defines.h
16+
depthmap.o: depthmap.cc ../../libs/math/defines.h \
17+
../../libs/math/matrix.h ../../libs/math/algo.h \
18+
../../libs/math/vector.h ../../libs/mve/mesh_info.h \
19+
../../libs/mve/defines.h ../../libs/mve/mesh.h \
20+
../../libs/mve/depthmap.h ../../libs/mve/camera.h \
21+
../../libs/mve/image.h ../../libs/math/functions.h \
22+
../../libs/mve/image_base.h ../../libs/util/strings.h \
23+
../../libs/util/defines.h ../../libs/mve/mesh_tools.h
24+
image_exif.o: image_exif.cc ../../libs/util/system.h \
25+
../../libs/util/defines.h ../../libs/util/strings.h \
26+
../../libs/mve/image_exif.h ../../libs/mve/defines.h
27+
image_io.o: image_io.cc ../../libs/math/algo.h ../../libs/math/defines.h \
28+
../../libs/util/exception.h ../../libs/util/defines.h \
29+
../../libs/util/strings.h ../../libs/util/system.h \
30+
../../libs/mve/image_io.h ../../libs/mve/defines.h \
31+
../../libs/mve/image.h ../../libs/math/functions.h \
32+
../../libs/math/vector.h ../../libs/math/matrix.h \
33+
../../libs/mve/image_base.h
34+
image_tools.o: image_tools.cc ../../libs/mve/camera.h \
35+
../../libs/mve/defines.h ../../libs/mve/image_tools.h \
36+
../../libs/util/exception.h ../../libs/util/defines.h \
37+
../../libs/math/accum.h ../../libs/math/functions.h \
38+
../../libs/math/defines.h ../../libs/math/vector.h \
39+
../../libs/math/algo.h ../../libs/math/matrix.h ../../libs/mve/image.h \
40+
../../libs/mve/image_base.h ../../libs/util/strings.h
41+
marching.o: marching.cc ../../libs/mve/defines.h
42+
mesh.o: mesh.cc ../../libs/math/defines.h ../../libs/math/functions.h \
43+
../../libs/math/vector.h ../../libs/math/algo.h \
44+
../../libs/math/matrix.h ../../libs/mve/mesh.h \
45+
../../libs/mve/defines.h
46+
mesh_info.o: mesh_info.cc ../../libs/mve/mesh_info.h \
47+
../../libs/mve/defines.h ../../libs/mve/mesh.h \
48+
../../libs/math/vector.h ../../libs/math/defines.h \
49+
../../libs/math/algo.h
50+
mesh_io.o: mesh_io.cc ../../libs/util/strings.h ../../libs/util/defines.h \
51+
../../libs/mve/mesh.h ../../libs/math/vector.h \
52+
../../libs/math/defines.h ../../libs/math/algo.h \
53+
../../libs/mve/defines.h ../../libs/mve/mesh_io.h \
54+
../../libs/mve/mesh_io_ply.h ../../libs/util/system.h \
55+
../../libs/mve/image.h ../../libs/math/functions.h \
56+
../../libs/math/matrix.h ../../libs/mve/image_base.h \
57+
../../libs/mve/camera.h ../../libs/mve/view.h \
58+
../../libs/mve/mesh_io_off.h ../../libs/mve/mesh_io_npts.h \
59+
../../libs/mve/mesh_io_pbrt.h ../../libs/mve/mesh_io_smf.h \
60+
../../libs/mve/mesh_io_obj.h
61+
mesh_io_npts.o: mesh_io_npts.cc ../../libs/util/exception.h \
62+
../../libs/util/defines.h ../../libs/math/vector.h \
63+
../../libs/math/defines.h ../../libs/math/algo.h ../../libs/mve/mesh.h \
64+
../../libs/mve/defines.h ../../libs/mve/mesh_io_npts.h
65+
mesh_io_obj.o: mesh_io_obj.cc ../../libs/util/strings.h \
66+
../../libs/util/defines.h ../../libs/util/tokenizer.h \
67+
../../libs/util/exception.h ../../libs/util/file_system.h \
68+
../../libs/mve/mesh_io_obj.h ../../libs/mve/mesh.h \
69+
../../libs/math/vector.h ../../libs/math/defines.h \
70+
../../libs/math/algo.h ../../libs/mve/defines.h
71+
mesh_io_off.o: mesh_io_off.cc ../../libs/math/vector.h \
72+
../../libs/math/defines.h ../../libs/math/algo.h \
73+
../../libs/util/exception.h ../../libs/util/defines.h \
74+
../../libs/mve/mesh_io_off.h ../../libs/mve/defines.h \
75+
../../libs/mve/mesh.h
76+
mesh_io_pbrt.o: mesh_io_pbrt.cc ../../libs/util/exception.h \
77+
../../libs/util/defines.h ../../libs/mve/mesh_io_pbrt.h \
78+
../../libs/mve/mesh.h ../../libs/math/vector.h \
79+
../../libs/math/defines.h ../../libs/math/algo.h \
80+
../../libs/mve/defines.h
81+
mesh_io_ply.o: mesh_io_ply.cc ../../libs/util/exception.h \
82+
../../libs/util/defines.h ../../libs/util/tokenizer.h \
83+
../../libs/util/strings.h ../../libs/math/vector.h \
84+
../../libs/math/defines.h ../../libs/math/algo.h \
85+
../../libs/math/matrix.h ../../libs/mve/depthmap.h \
86+
../../libs/mve/defines.h ../../libs/mve/camera.h \
87+
../../libs/mve/image.h ../../libs/math/functions.h \
88+
../../libs/mve/image_base.h ../../libs/mve/mesh.h \
89+
../../libs/mve/mesh_io_ply.h ../../libs/util/system.h \
90+
../../libs/mve/view.h
91+
mesh_io_smf.o: mesh_io_smf.cc ../../libs/util/exception.h \
92+
../../libs/util/defines.h ../../libs/mve/mesh_io_smf.h \
93+
../../libs/mve/mesh.h ../../libs/math/vector.h \
94+
../../libs/math/defines.h ../../libs/math/algo.h \
95+
../../libs/mve/defines.h
96+
mesh_tools.o: mesh_tools.cc ../../libs/math/algo.h \
97+
../../libs/math/defines.h ../../libs/math/vector.h \
98+
../../libs/mve/mesh_info.h ../../libs/mve/defines.h \
99+
../../libs/mve/mesh.h ../../libs/mve/mesh_tools.h \
100+
../../libs/math/matrix.h
101+
scene.o: scene.cc ../../libs/util/exception.h ../../libs/util/defines.h \
102+
../../libs/util/timer.h ../../libs/util/file_system.h \
103+
../../libs/mve/scene.h ../../libs/mve/defines.h ../../libs/mve/view.h \
104+
../../libs/mve/camera.h ../../libs/mve/image_base.h \
105+
../../libs/util/strings.h ../../libs/mve/image.h \
106+
../../libs/math/functions.h ../../libs/math/defines.h \
107+
../../libs/math/vector.h ../../libs/math/algo.h \
108+
../../libs/math/matrix.h ../../libs/mve/bundle.h ../../libs/mve/mesh.h \
109+
../../libs/mve/bundle_io.h
110+
view.o: view.cc ../../libs/util/exception.h ../../libs/util/defines.h \
111+
../../libs/util/file_system.h ../../libs/util/tokenizer.h \
112+
../../libs/util/strings.h ../../libs/util/ini_parser.h \
113+
../../libs/mve/view.h ../../libs/mve/defines.h ../../libs/mve/camera.h \
114+
../../libs/mve/image_base.h ../../libs/mve/image.h \
115+
../../libs/math/functions.h ../../libs/math/defines.h \
116+
../../libs/math/vector.h ../../libs/math/algo.h \
117+
../../libs/math/matrix.h ../../libs/mve/image_io.h
118+
volume.o: volume.cc ../../libs/math/vector.h ../../libs/math/defines.h \
119+
../../libs/math/algo.h ../../libs/mve/marching_tets.h \
120+
../../libs/math/functions.h ../../libs/math/matrix.h \
121+
../../libs/mve/defines.h ../../libs/mve/mesh.h \
122+
../../libs/mve/marching_cubes.h ../../libs/mve/image.h \
123+
../../libs/mve/image_base.h ../../libs/util/strings.h \
124+
../../libs/util/defines.h ../../libs/mve/volume.h

core/bundle.cc

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* Copyright (C) 2015, Simon Fuhrmann
3+
* TU Darmstadt - Graphics, Capture and Massively Parallel Computing
4+
* All rights reserved.
5+
*
6+
* This software may be modified and distributed under the terms
7+
* of the BSD 3-Clause license. See the LICENSE.txt file for details.
8+
*/
9+
10+
#include "core/bundle.h"
11+
12+
CORE_NAMESPACE_BEGIN
13+
14+
bool
15+
Bundle::Feature3D::contains_view_id (int id) const
16+
{
17+
for (std::size_t i = 0; i < this->refs.size(); ++i)
18+
if (this->refs[i].view_id == id)
19+
return true;
20+
return false;
21+
}
22+
23+
/* -------------------------------------------------------------- */
24+
25+
std::size_t
26+
Bundle::get_byte_size (void) const
27+
{
28+
std::size_t ret = 0;
29+
ret += this->cameras.capacity() * sizeof(CameraInfo);
30+
ret += this->features.capacity() * sizeof(Feature3D);
31+
for (std::size_t i = 0; i < this->features.size(); ++i)
32+
ret += this->features[i].refs.capacity() * sizeof(Feature2D);
33+
return ret;
34+
}
35+
36+
/* -------------------------------------------------------------- */
37+
38+
std::size_t
39+
Bundle::get_num_cameras (void) const
40+
{
41+
return this->cameras.size();
42+
}
43+
44+
/* -------------------------------------------------------------- */
45+
46+
std::size_t
47+
Bundle::get_num_valid_cameras (void) const
48+
{
49+
std::size_t ret = 0;
50+
for (std::size_t i = 0; i < this->cameras.size(); ++i)
51+
ret += (this->cameras[i].flen != 0.0f ? 1 : 0);
52+
return ret;
53+
}
54+
55+
/* -------------------------------------------------------------- */
56+
57+
TriangleMesh::Ptr
58+
Bundle::get_features_as_mesh (void) const
59+
{
60+
TriangleMesh::Ptr mesh = core::TriangleMesh::create();
61+
TriangleMesh::VertexList& verts = mesh->get_vertices();
62+
TriangleMesh::ColorList& colors = mesh->get_vertex_colors();
63+
for (std::size_t i = 0; i < this->features.size(); ++i)
64+
{
65+
Bundle::Feature3D const& f = this->features[i];
66+
verts.push_back(math::Vec3f(f.pos));
67+
colors.push_back(math::Vec4f(f.color[0], f.color[1], f.color[2], 1.0f));
68+
}
69+
return mesh;
70+
}
71+
72+
/* -------------------------------------------------------------- */
73+
74+
void
75+
Bundle::delete_camera (std::size_t index)
76+
{
77+
if (index >= this->cameras.size())
78+
throw std::invalid_argument("Invalid camera index");
79+
80+
/* Mark the deleted camera as invalid. */
81+
this->cameras[index].flen = 0.0f;
82+
83+
/* Delete all SIFT features that are visible in this camera. */
84+
for (std::size_t i = 0; i < this->features.size(); ++i)
85+
{
86+
Feature3D& feature = this->features[i];
87+
typedef std::vector<Feature2D> FeatureRefs;
88+
FeatureRefs& refs = feature.refs;
89+
90+
for (FeatureRefs::iterator iter = refs.begin(); iter != refs.end();)
91+
if (iter->view_id == static_cast<int>(index))
92+
iter = refs.erase(iter);
93+
else
94+
iter++;
95+
}
96+
}
97+
98+
CORE_NAMESPACE_END

0 commit comments

Comments
 (0)