• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..04-Jul-2021-

cmake/H04-Jul-2021-826758

doc/pics/H04-Jul-2021-

include/opencv2/H04-Jul-2021-1,358390

samples/H04-Jul-2021-776538

src/H04-Jul-2021-15,4379,021

test/H04-Jul-2021-1,331678

tutorials/H04-Jul-2021-312214

README.mdH A D04-Jul-20216 KiB11982

README.md

1Structure From Motion module
2============================
3
4This module contains algorithms to perform 3d reconstruction from 2d images. The core of the module is a light version of [Libmv](https://developer.blender.org/project/profile/59), which is a Library for Multiview Reconstruction (or LMV) divided into different modules (correspondence/numeric/multiview/simple_pipeline) that allow to resolve part of the SfM process.
5
6
7Dependencies
8------------
9
10Before compiling, take a look at the following details in order to give a proper use of the Structure from Motion module. **Advice:** The module is only available for Linux/GNU systems.
11
12In addition, it depends on some open source libraries:
13
14- [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page) 3.2.2 or later. **Required**
15- [Google Log](http://code.google.com/p/google-glog) 0.3.1 or later. **Required**
16- [Google Flags](http://code.google.com/p/gflags). **Required**
17- [Ceres Solver](http://ceres-solver.org). Needed by the reconstruction API in order to solve part of the Bundle Adjustment plus the points Intersect. If Ceres Solver is not installed on your system, the reconstruction funcionality will be disabled. **Recommended**
18
19Installation
20------------
21**Required Dependencies**
22
23In case you are on [Ubuntu](http://www.ubuntu.com/) you can simply install the required dependencies by typing the following command.
24
25    sudo apt-get install libeigen3-dev libgflags-dev libgoogle-glog-dev
26
27**Ceres Solver**
28
29Start by installing all the dependencies.
30
31    # CMake
32    sudo apt-get install cmake
33    # google-glog + gflags
34    sudo apt-get install libgoogle-glog-dev
35    # BLAS & LAPACK
36    sudo apt-get install libatlas-base-dev
37    # Eigen3
38    sudo apt-get install libeigen3-dev
39    # SuiteSparse and CXSparse (optional)
40    # - If you want to build Ceres as a *static* library (the default)
41    #   you can use the SuiteSparse package in the main Ubuntu package
42    #   repository:
43    sudo apt-get install libsuitesparse-dev
44    # - However, if you want to build Ceres as a *shared* library, you must
45    #   add the following PPA:
46    sudo add-apt-repository ppa:bzindovic/suitesparse-bugfix-1319687
47    sudo apt-get update
48    sudo apt-get install libsuitesparse-dev
49
50We are now ready to build, test, and install Ceres.
51
52    git clone https://ceres-solver.googlesource.com/ceres-solver
53    cd ceres-solver
54    mkdir build && cd build
55    cmake ..
56    make -j4
57    make test
58    sudo make install
59
60Usage
61-----
62
63**trajectory_reconstruction.cpp**
64
65This program shows the camera trajectory reconstruction capabilities in the OpenCV Structure From Motion (SFM) module. It loads a file with the tracked 2d points over all the frames which are embedded into a vector of 2d points array, where each inner array represents a different frame. Every frame is composed by a list of 2d points which e.g. the first point in frame 1 is the same point in frame 2. If there is no point in a frame the assigned value will be (-1,-1).
66
67To run this example you can type the following command in the opencv binaries directory specifying the file path in your system and the camera intrinsics (in this case the tracks file was obtained using Blender Motion module).
68
69    ./example_sfm_trajectory_reconstruction tracks_file.txt 1914 640 360
70
71Finally, the script reconstructs the given set of tracked points and show the result using the OpenCV 3D visualizer (viz). On the image below, it's shown a screenshot with the result you should obtain running the "desktop_tracks.txt" found inside the samples directory.
72
73<p align="center">
74  <img src="doc/pics/desktop_trajectory.png" width="400" height="300">
75</p>
76
77**scene_reconstruction.cpp**
78
79This program shows the multiview scene reconstruction capabilities in the OpenCV Structure From Motion (SFM) module. It calls the recontruction API using the overloaded signature for real images. In this case the script loads a file which provides a list with all the image paths that we want to reconstruct. Internally, this script extract and compute the sparse 2d features using DAISY descriptors which are matched using FlannBasedMatcher to finally build the tracks structure.
80
81To run this example you can type the following command in the opencv binaries directory specifying the file path  and the camera intrinsics.
82
83    ./example_sfm_scene_reconstruction image_paths_file.txt 350 240 360
84
85This sample shows the estimated camera trajectory plus the sparse 3D reconstruction using the the OpenCV 3D visualizer (viz).
86
87On the next pictures, it's shown a screenshot where you can see the used images as input from the "Temple of the Dioskouroi" [1] and the obtained result after running the reconstruction API.
88
89<p align="center">
90  <img src="doc/pics/temple_input.jpg" width="800" height="200">
91</p>
92<p align="center">
93  <img src="doc/pics/temple_reconstruction.jpg" width="400" height="250">
94</p>
95
96On the next pictures, it's shown a screenshot where you can see the used images as input from la Sagrada Familia (BCN) [2] which you can find in the samples directory and the obtained result after running the reconstruction API.
97
98<p align="center">
99  <img src="doc/pics/sagrada_familia_input.jpg" width="700" height="250">
100</p>
101<p align="center">
102  <img src="doc/pics/sagrada_familia_reconstruction.jpg" width="400" height="250">
103</p>
104
105
106[1] [http://vision.middlebury.edu/mview/data](http://vision.middlebury.edu/mview/data)
107
108[2] Penate Sanchez, A. and Moreno-Noguer, F. and Andrade Cetto, J. and Fleuret, F. (2014). LETHA: *Learning from High Quality Inputs for 3D Pose Estimation in Low Quality Images*. Proceedings of the International Conference on 3D vision (3DV). [[URL]](http://www.iri.upc.edu/research/webprojects/pau/datasets/sagfam)
109
110
111Future Work
112-----------
113
114* Update signatures documentation.
115* Add prototype for dense reconstruction once is working (DAISY paper implementation).
116* Decide which functions are kept since most of them are the same in calib3d.
117* Finish to implement computeOrientation().
118* Find a good features matchig algorithm for reconstruction() in case we provide pure images for autocalibration (look into OpenMVG).
119