-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtutorial.html
602 lines (582 loc) · 46.6 KB
/
tutorial.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tutorial — COLMAP 3.12.0.dev0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<link rel="stylesheet" type="text/css" href="_static/custom.css?v=4eec7147" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=3a07dcc1"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Database Format" href="database.html" />
<link rel="prev" title="Installation" href="install.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
COLMAP
</a>
<div class="version">
3.12.0.dev0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="install.html">Installation</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Tutorial</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#quickstart">Quickstart</a></li>
<li class="toctree-l2"><a class="reference internal" href="#structure-from-motion">Structure-from-Motion</a></li>
<li class="toctree-l2"><a class="reference internal" href="#multi-view-stereo">Multi-View Stereo</a></li>
<li class="toctree-l2"><a class="reference internal" href="#preface">Preface</a></li>
<li class="toctree-l2"><a class="reference internal" href="#terminology">Terminology</a></li>
<li class="toctree-l2"><a class="reference internal" href="#data-structure">Data Structure</a></li>
<li class="toctree-l2"><a class="reference internal" href="#feature-detection-and-extraction">Feature Detection and Extraction</a></li>
<li class="toctree-l2"><a class="reference internal" href="#feature-matching-and-geometric-verification">Feature Matching and Geometric Verification</a></li>
<li class="toctree-l2"><a class="reference internal" href="#sparse-reconstruction">Sparse Reconstruction</a></li>
<li class="toctree-l2"><a class="reference internal" href="#importing-and-exporting">Importing and Exporting</a></li>
<li class="toctree-l2"><a class="reference internal" href="#dense-reconstruction">Dense Reconstruction</a></li>
<li class="toctree-l2"><a class="reference internal" href="#database-management">Database Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="#graphical-and-command-line-interface">Graphical and Command-line Interface</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="database.html">Database Format</a></li>
<li class="toctree-l1"><a class="reference internal" href="cameras.html">Camera Models</a></li>
<li class="toctree-l1"><a class="reference internal" href="format.html">Output Format</a></li>
<li class="toctree-l1"><a class="reference internal" href="datasets.html">Datasets</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui.html">Graphical User Interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="cli.html">Command-line Interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="pycolmap/index.html">PyCOLMAP</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
<li class="toctree-l1"><a class="reference internal" href="contribution.html">Contribution</a></li>
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="bibliography.html">Bibliography</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">COLMAP</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Tutorial</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/tutorial.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="tutorial">
<span id="id1"></span><h1>Tutorial<a class="headerlink" href="#tutorial" title="Link to this heading"></a></h1>
<p>This tutorial covers the topic of image-based 3D reconstruction by demonstrating
the individual processing steps in COLMAP. If you are interested in a more
general and mathematical introduction to the topic of image-based 3D
reconstruction, please also refer to the <a class="reference external" href="https://demuc.de/tutorials/cvpr2017/">CVPR 2017 Tutorial on Large-scale 3D
Modeling from Crowdsourced Data</a> and
<a class="reference internal" href="bibliography.html#schoenberger-thesis" id="id2"><span>[schoenberger_thesis]</span></a>.</p>
<p>Image-based 3D reconstruction from images traditionally first recovers a sparse
representation of the scene and the camera poses of the input images using
Structure-from-Motion. This output then serves as the input to Multi-View Stereo
to recover a dense representation of the scene.</p>
<section id="quickstart">
<span id="quick-start"></span><h2>Quickstart<a class="headerlink" href="#quickstart" title="Link to this heading"></a></h2>
<p>First, start the graphical user interface of COLMAP, as described <a class="reference internal" href="gui.html#gui"><span class="std std-ref">here</span></a>. COLMAP provides an automatic reconstruction tool that simply takes
a folder of input images and produces a sparse and dense reconstruction in a
workspace folder. Click <code class="docutils literal notranslate"><span class="pre">Reconstruction</span> <span class="pre">></span> <span class="pre">Automatic</span> <span class="pre">Reconstruction</span></code> in the GUI
and specify the relevant options. The output is written to the workspace folder.
For example, if your images are located in <code class="docutils literal notranslate"><span class="pre">path/to/project/images</span></code>, you could
select <code class="docutils literal notranslate"><span class="pre">path/to/project</span></code> as a workspace folder and after running the automatic
reconstruction tool, the folder would look similar to this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>+── images
│ +── image1.jpg
│ +── image2.jpg
│ +── ...
+── sparse
│ +── 0
│ │ +── cameras.bin
│ │ +── images.bin
│ │ +── points3D.bin
│ +── ...
+── dense
│ +── 0
│ │ +── images
│ │ +── sparse
│ │ +── stereo
│ │ +── fused.ply
│ │ +── meshed-poisson.ply
│ │ +── meshed-delaunay.ply
│ +── ...
+── database.db
</pre></div>
</div>
<p>Here, the <code class="docutils literal notranslate"><span class="pre">path/to/project/sparse</span></code> contains the sparse models for all
reconstructed components, while <code class="docutils literal notranslate"><span class="pre">path/to/project/dense</span></code> contains their
corresponding dense models. The dense point cloud <code class="docutils literal notranslate"><span class="pre">fused.ply</span></code> can be imported
in COLMAP using <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Import</span> <span class="pre">model</span> <span class="pre">from</span> <span class="pre">...</span></code>, while the dense mesh must be
visualized with an external viewer such as Meshlab.</p>
<p>The following sections give general recommendations and describe the
reconstruction process in more detail, if you need more control over the
reconstruction process/parameters or if you are interested in the underlying
technology in COLMAP.</p>
</section>
<section id="structure-from-motion">
<h2>Structure-from-Motion<a class="headerlink" href="#structure-from-motion" title="Link to this heading"></a></h2>
<figure class="align-center align-default" id="id19">
<img alt="Incremental Structure-from-Motion pipeline" src="_images/incremental-sfm.png" />
<figcaption>
<p><span class="caption-text">COLMAP’s incremental Structure-from-Motion pipeline.</span><a class="headerlink" href="#id19" title="Link to this image"></a></p>
</figcaption>
</figure>
<p>Structure-from-Motion (SfM) is the process of reconstructing 3D structure from
its projections into a series of images. The input is a set of overlapping
images of the same object, taken from different viewpoints. The output is a 3-D
reconstruction of the object, and the reconstructed intrinsic and extrinsic
camera parameters of all images. Typically, Structure-from-Motion systems divide
this process into three stages:</p>
<ol class="arabic simple">
<li><p>Feature detection and extraction</p></li>
<li><p>Feature matching and geometric verification</p></li>
<li><p>Structure and motion reconstruction</p></li>
</ol>
<p>COLMAP reflects these stages in different modules, that can be combined
depending on the application. More information on Structure-from-Motion in
general and the algorithms in COLMAP can be found in <a class="reference internal" href="bibliography.html#schoenberger16sfm" id="id3"><span>[schoenberger16sfm]</span></a> and
<a class="reference internal" href="bibliography.html#schoenberger16mvs" id="id4"><span>[schoenberger16mvs]</span></a>.</p>
<p>If you have control over the picture capture process, please follow these
guidelines for optimal reconstruction results:</p>
<ul class="simple">
<li><p>Capture images with <strong>good texture</strong>. Avoid completely texture-less images
(e.g., a white wall or empty desk). If the scene does not contain enough
texture itself, you could place additional background objects, such as
posters, etc.</p></li>
<li><p>Capture images at <strong>similar illumination</strong> conditions. Avoid high dynamic
range scenes (e.g., pictures against the sun with shadows or pictures
through doors/windows). Avoid specularities on shiny surfaces.</p></li>
<li><p>Capture images with <strong>high visual overlap</strong>. Make sure that each object is
seen in at least 3 images – the more images the better.</p></li>
<li><p>Capture images from <strong>different viewpoints</strong>. Do not take images from the
same location by only rotating the camera, e.g., make a few steps after each
shot. At the same time, try to have enough images from a relatively similar
viewpoint. Note that more images is not necessarily better and might lead to a
slow reconstruction process. If you use a video as input, consider
down-sampling the frame rate.</p></li>
</ul>
</section>
<section id="multi-view-stereo">
<h2>Multi-View Stereo<a class="headerlink" href="#multi-view-stereo" title="Link to this heading"></a></h2>
<p>Multi-View Stereo (MVS) takes the output of SfM to compute depth and/or normal
information for every pixel in an image. Fusion of the depth and normal maps of
multiple images in 3D then produces a dense point cloud of the scene. Using the
depth and normal information of the fused point cloud, algorithms such as the
(screened) Poisson surface reconstruction <a class="reference internal" href="bibliography.html#kazhdan2013" id="id5"><span>[kazhdan2013]</span></a> can then recover the 3D
surface geometry of the scene. More information on Multi-View Stereo in general
and the algorithms in COLMAP can be found in <a class="reference internal" href="bibliography.html#schoenberger16mvs" id="id6"><span>[schoenberger16mvs]</span></a>.</p>
</section>
<section id="preface">
<h2>Preface<a class="headerlink" href="#preface" title="Link to this heading"></a></h2>
<p>COLMAP requires only few steps to do a standard reconstruction for a general
user. For more experienced users, the program exposes many different parameters,
only some of which are intuitive to a beginner. The program should usually work
without the need to modify any parameters. The defaults are chosen as a trade-
off between reconstruction robustness/quality and speed. You can set “optimal”
options for different reconstruction scenarios by choosing <code class="docutils literal notranslate"><span class="pre">Extras</span> <span class="pre">></span> <span class="pre">Set</span>
<span class="pre">options</span> <span class="pre">for</span> <span class="pre">...</span> <span class="pre">data</span></code>. If in doubt what settings to choose, stick to the
defaults. The source code contains more documentation about all parameters.</p>
<p>COLMAP is research software and in rare cases it may exit ungracefully if some
constraints are not fulfilled. In this case, the program prints a traceback to
stdout. To see this traceback or more debug information, it is recommended to
run the executables (including the GUI) from the command-line, where you can
define various levels of logging verbosity.</p>
</section>
<section id="terminology">
<h2>Terminology<a class="headerlink" href="#terminology" title="Link to this heading"></a></h2>
<p>The term <strong>camera</strong> is associated with the physical object of a camera using the
same zoom-factor and lens. A camera defines the intrinsic projection model in
COLMAP. A single camera can take multiple images with the same resolution,
intrinsic parameters, and distortion characteristics. The term <strong>image</strong> is
associated with a bitmap file, e.g., a JPEG or PNG file on disk. COLMAP detects
<strong>keypoints</strong> in each image whose appearance is described by numerical
<strong>descriptors</strong>. Pure appearance-based correspondences between
keypoints/descriptors are defined by <strong>matches</strong>, while <strong>inlier matches</strong> are
geometrically verified and used for the reconstruction procedure.</p>
</section>
<section id="data-structure">
<h2>Data Structure<a class="headerlink" href="#data-structure" title="Link to this heading"></a></h2>
<p>COLMAP assumes that all input images are in one input directory with potentially
nested sub-directories. It recursively considers all images stored in this
directory, and it supports various different image formats (see <a class="reference external" href="http://freeimage.sourceforge.net/documentation.html">FreeImage</a>). Other files are
automatically ignored. If high performance is a requirement, then you should
separate any files that are not images. Images are identified uniquely by their
relative file path. For later processing, such as image undistortion or dense
reconstruction, the relative folder structure should be preserved. COLMAP does
not modify the input images or directory and all extracted data is stored in a
single, self-contained SQLite database file (see <a class="reference internal" href="database.html"><span class="doc">Database Format</span></a>).</p>
<p>The first step is to start the graphical user interface of COLMAP by running the
pre-built binaries (Windows: <cite>COLMAP.bat</cite>, Mac: <cite>COLMAP.app</cite>) or by executing
<code class="docutils literal notranslate"><span class="pre">./src/colmap/exe/colmap</span> <span class="pre">gui</span></code> from the CMake build folder. Next, create a new project
by choosing <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">New</span> <span class="pre">project</span></code>. In this dialog, you must select where to
store the database and the folder that contains the input images. For
convenience, you can save the entire project settings to a configuration file by
choosing <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Save</span> <span class="pre">project</span></code>. The project configuration stores the absolute
path information of the database and image folder in addition to any other
parameter settings. If you decide to move the database or image folder, you must
change the paths accordingly by creating a new project. Alternatively, the
resulting <cite>.ini</cite> configuration file can be directly modified in a text editor of
your choice. To reopen an existing project, you can simply open the
configuration file by choosing <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Open</span> <span class="pre">project</span></code> and all parameter
settings should be recovered. Note that all COLMAP executables can be started
from the command-line by either specifying individual settings as command-line
arguments or by providing the path to the project configuration file (see
<a class="reference internal" href="#interface"><span class="std std-ref">Interface</span></a>).</p>
<p>An example folder structure could look like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>/path/to/project/...
+── images
│ +── image1.jpg
│ +── image2.jpg
│ +── ...
│ +── imageN.jpg
+── database.db
+── project.ini
</pre></div>
</div>
<p>In this example, you would select <cite>/path/to/project/images</cite> as the image folder
path, <cite>/path/to/project/database.db</cite> as the database file path, and save the
project configuration to <cite>/path/to/project/project.ini</cite>.</p>
</section>
<section id="feature-detection-and-extraction">
<h2>Feature Detection and Extraction<a class="headerlink" href="#feature-detection-and-extraction" title="Link to this heading"></a></h2>
<p>In the first step, feature detection/extraction finds sparse feature points in
the image and describes their appearance using a numerical descriptor. COLMAP
imports images and performs feature detection/extraction in one step in order to
only load images from disk once.</p>
<p>Next, choose <code class="docutils literal notranslate"><span class="pre">Processing</span> <span class="pre">></span> <span class="pre">Extract</span> <span class="pre">features</span></code>. In this dialog, you must first
decide on the employed intrinsic camera model. You can either automatically
extract focal length information from the embedded EXIF information or manually
specify intrinsic parameters, e.g., as obtained in a lab calibration. If an
image has partial EXIF information, COLMAP tries to find the missing camera
specifications in a large database of camera models automatically. If all your
images were captured by the same physical camera with identical zoom factor, it
is recommended to share intrinsics between all images. Note that the program
will exit ungracefully if the same camera model is shared among all images but
not all images have the same size or EXIF focal length. If you have several
groups of images that share the same intrinsic camera parameters, you can easily
modify the camera models at a later point as well (see <a class="reference internal" href="#database-management"><span class="std std-ref">Database Management</span></a>). If in doubt what to choose in this step, simply stick
to the default parameters.</p>
<p>You can either detect and extract new features from the images or import
existing features from text files. COLMAP extracts SIFT <a class="reference internal" href="bibliography.html#lowe04" id="id7"><span>[lowe04]</span></a> features
either on the GPU or the CPU. The GPU version requires an attached display,
while the CPU version is recommended for use on a server. In general, the GPU
version is favorable as it has a customized feature detection mode that often
produces higher quality features in the case of high contrast images. If you
import existing features, every image must have a text file next to it (e.g.,
<cite>/path/to/image1.jpg</cite> and <cite>/path/to/image1.jpg.txt</cite>) in the following format:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">NUM_FEATURES</span> <span class="mi">128</span>
<span class="n">X</span> <span class="n">Y</span> <span class="n">SCALE</span> <span class="n">ORIENTATION</span> <span class="n">D_1</span> <span class="n">D_2</span> <span class="n">D_3</span> <span class="o">...</span> <span class="n">D_128</span>
<span class="o">...</span>
<span class="n">X</span> <span class="n">Y</span> <span class="n">SCALE</span> <span class="n">ORIENTATION</span> <span class="n">D_1</span> <span class="n">D_2</span> <span class="n">D_3</span> <span class="o">...</span> <span class="n">D_128</span>
</pre></div>
</div>
<p>where <cite>X, Y, SCALE, ORIENTATION</cite> are floating point numbers and <cite>D_1…D_128</cite>
values in the range <cite>0…255</cite>. The file should have <cite>NUM_FEATURES</cite> lines with
one line per feature. For example, if an image has 4 features, then the text
file should look something like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">4</span> <span class="mi">128</span>
<span class="mf">1.2</span> <span class="mf">2.3</span> <span class="mf">0.1</span> <span class="mf">0.3</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">3</span> <span class="mi">4</span> <span class="o">...</span> <span class="mi">21</span>
<span class="mf">2.2</span> <span class="mf">3.3</span> <span class="mf">1.1</span> <span class="mf">0.3</span> <span class="mi">3</span> <span class="mi">2</span> <span class="mi">3</span> <span class="mi">2</span> <span class="o">...</span> <span class="mi">32</span>
<span class="mf">0.2</span> <span class="mf">1.3</span> <span class="mf">1.1</span> <span class="mf">0.3</span> <span class="mi">3</span> <span class="mi">2</span> <span class="mi">3</span> <span class="mi">2</span> <span class="o">...</span> <span class="mi">2</span>
<span class="mf">1.2</span> <span class="mf">2.3</span> <span class="mf">1.1</span> <span class="mf">0.3</span> <span class="mi">3</span> <span class="mi">2</span> <span class="mi">3</span> <span class="mi">2</span> <span class="o">...</span> <span class="mi">3</span>
</pre></div>
</div>
<p>Note that by convention the upper left corner of an image has coordinate <cite>(0,
0)</cite> and the center of the upper left most pixel has coordinate <cite>(0.5, 0.5)</cite>. If
you must import features for large image collections, it is much more efficient
to directly access the database with your favorite scripting language (see
<a class="reference internal" href="database.html#database-format"><span class="std std-ref">Database Format</span></a>).</p>
<p>If you are done setting all options, choose <code class="docutils literal notranslate"><span class="pre">Extract</span></code> and wait for the
extraction to finish or cancel. If you cancel during the extraction process, the
next time you start extracting images for the same project, COLMAP automatically
continues where it left off. This also allows you to add images to an existing
project/reconstruction. In this case, be sure to verify the camera parameters
when using shared intrinsics.</p>
<p>All extracted data will be stored in the database file and can be
reviewed/managed in the database management tool (see <a class="reference internal" href="#database-management"><span class="std std-ref">Database Management</span></a>) or, for experts, directly modified using SQLite (see
<a class="reference internal" href="database.html#database-format"><span class="std std-ref">Database Format</span></a>).</p>
</section>
<section id="feature-matching-and-geometric-verification">
<h2>Feature Matching and Geometric Verification<a class="headerlink" href="#feature-matching-and-geometric-verification" title="Link to this heading"></a></h2>
<p>In the second step, feature matching and geometric verification finds
correspondences between the feature points in different images.</p>
<p>Please, choose <code class="docutils literal notranslate"><span class="pre">Processing</span> <span class="pre">></span> <span class="pre">Feature</span> <span class="pre">matching</span></code> and select one of the provided
matching modes, that are intended for different input scenarios:</p>
<ul>
<li><p><strong>Exhaustive Matching</strong>: If the number of images in your dataset is
relatively low (up to several hundreds), this matching mode should be fast
enough and leads to the best reconstruction results. Here, every image is
matched against every other image, while the block size determines how many
images are loaded from disk into memory at the same time.</p></li>
<li><p><strong>Sequential Matching</strong>: This mode is useful if the images are acquired in
sequential order, e.g., by a video camera. In this case, consecutive frames
have visual overlap and there is no need to match all image pairs
exhaustively. Instead, consecutively captured images are matched against
each other. This matching mode has built-in loop detection based on a
vocabulary tree, where every N-th image (<cite>loop_detection_period</cite>) is matched
against its visually most similar images (<cite>loop_detection_num_images</cite>). Note
that image file names must be ordered sequentially (e.g., <cite>image0001.jpg</cite>,
<cite>image0002.jpg</cite>, etc.). The order in the database is not relevant, since the
images are explicitly ordered according to their file names. Note that loop
detection requires a pre-trained vocabulary tree, that can be downloaded
from <a class="reference external" href="https://demuc.de/colmap/">https://demuc.de/colmap/</a>.</p></li>
<li><p><strong>Vocabulary Tree Matching</strong>: In this matching mode <a class="reference internal" href="bibliography.html#schoenberger16vote" id="id8"><span>[schoenberger16vote]</span></a>,
every image is matched against its visual nearest neighbors using a vocabulary
tree with spatial re-ranking. This is the recommended matching mode for large
image collections (several thousands). This requires a pre-trained vocabulary
tree, that can be downloaded from <a class="reference external" href="https://demuc.de/colmap/">https://demuc.de/colmap/</a>.</p></li>
<li><p><strong>Spatial Matching</strong>: This matching mode matches every image against its
spatial nearest neighbors. Spatial locations can be manually set in the
database management. By default, COLMAP also extracts GPS information from
EXIF and uses it for spatial nearest neighbor search. If accurate prior
location information is available, this is the recommended matching mode.</p></li>
<li><p><strong>Transitive Matching</strong>: This matching mode uses the transitive relations of
already existing feature matches to produce a more complete matching graph.
If an image A matches to an image B and B matches to C, then this matcher
attempts to match A to C directly.</p></li>
<li><p><strong>Custom Matching</strong>: This mode allows to specify individual image pairs for
matching or to import individual feature matches. To specify image pairs, you
have to provide a text file with one image pair per line:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">image1</span><span class="o">.</span><span class="n">jpg</span> <span class="n">image2</span><span class="o">.</span><span class="n">jpg</span>
<span class="n">image1</span><span class="o">.</span><span class="n">jpg</span> <span class="n">image3</span><span class="o">.</span><span class="n">jpg</span>
<span class="o">...</span>
</pre></div>
</div>
<p>where <cite>image1.jpg</cite> is the relative path in the image folder. You have two
options to import individual feature matches. Either raw feature matches,
which are not geometrically verified or already geometrically verified feature
matches. In both cases, the expected format is:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">image1</span><span class="o">.</span><span class="n">jpg</span> <span class="n">image2</span><span class="o">.</span><span class="n">jpg</span>
<span class="mi">0</span> <span class="mi">1</span>
<span class="mi">1</span> <span class="mi">2</span>
<span class="mi">3</span> <span class="mi">4</span>
<span class="o"><</span><span class="n">empty</span><span class="o">-</span><span class="n">line</span><span class="o">></span>
<span class="n">image1</span><span class="o">.</span><span class="n">jpg</span> <span class="n">image3</span><span class="o">.</span><span class="n">jpg</span>
<span class="mi">0</span> <span class="mi">1</span>
<span class="mi">1</span> <span class="mi">2</span>
<span class="mi">3</span> <span class="mi">4</span>
<span class="mi">4</span> <span class="mi">5</span>
<span class="o"><</span><span class="n">empty</span><span class="o">-</span><span class="n">line</span><span class="o">></span>
<span class="o">...</span>
</pre></div>
</div>
<p>where <cite>image1.jpg</cite> is the relative path in the image folder and the pairs of
numbers are zero-based feature indices in the respective images. If you must
import many matches for large image collections, it is more efficient to
directly access the database with a scripting language of your choice.</p>
</li>
</ul>
<p>If you are done setting all options, choose <code class="docutils literal notranslate"><span class="pre">Match</span></code> and wait for the matching
to finish or cancel in between. Note that this step can take a significant
amount of time depending on the number of images, the number of features per
image, and the chosen matching mode. Expected times for exhaustive matching are
from a few minutes for tens of images to a few hours for hundreds of images to
days or weeks for thousands of images. If you cancel the matching process or
import new images after matching, COLMAP only matches image pairs that have not
been matched previously. The overhead of skipping already matched image pairs is
low. This also enables to match additional images imported after an initial
matching and it enables to combine different matching modes for the same
dataset.</p>
<p>All extracted data will be stored in the database file and can be
reviewed/managed in the database management tool (see <a class="reference internal" href="#database-management"><span class="std std-ref">Database Management</span></a>) or, for experts, directly modified using SQLite (see
<a class="reference internal" href="database.html#database-format"><span class="std std-ref">Database Format</span></a>).</p>
<p>Note that feature matching requires a GPU and that the display performance of
your computer might degrade significantly during the matching process. If your
system has multiple CUDA-enabled GPUs, you can select specific GPUs with the
<cite>gpu_index</cite> option.</p>
</section>
<section id="sparse-reconstruction">
<h2>Sparse Reconstruction<a class="headerlink" href="#sparse-reconstruction" title="Link to this heading"></a></h2>
<p>After producing the scene graph in the previous two steps, you can start the
incremental reconstruction process by choosing <code class="docutils literal notranslate"><span class="pre">Reconstruction</span> <span class="pre">></span> <span class="pre">Start</span></code>.
COLMAP first loads all extracted data from the database into memory and seeds
the reconstruction from an initial image pair. Then, the scene is incrementally
extended by registering new images and triangulating new points. The results are
visualized in “real-time” during this reconstruction process. Refer to the
<a class="reference internal" href="gui.html#gui"><span class="std std-ref">Graphical User Interface</span></a> section for more details about the
available controls. COLMAP attempts to reconstruct multiple models if not all
images are registered into the same model. The different models can be selected
from the drop-down menu in the toolbar. If the different models have common
registered images, you can use the <code class="docutils literal notranslate"><span class="pre">model_converter</span></code> executable to merge them
into a single reconstruction (see <a class="reference internal" href="faq.html#faq-merge-models"><span class="std std-ref">FAQ</span></a> for details).</p>
<p>Ideally, the reconstruction works fine and all images are registered. If this is
not the case, it is recommended to:</p>
<ul class="simple">
<li><p>Perform additional matching. For best results, use exhaustive matching, enable
guided matching, increase the number of nearest neighbors in vocabulary tree
matching, or increase the overlap in sequential matching, etc.</p></li>
<li><p>Manually choose an initial image pair, if COLMAP fails to initialize. Choose
<code class="docutils literal notranslate"><span class="pre">Reconstruction</span> <span class="pre">></span> <span class="pre">Reconstruction</span> <span class="pre">options</span> <span class="pre">></span> <span class="pre">Init</span></code> and set images from the
database management tool that have enough matches from different viewpoints.</p></li>
</ul>
</section>
<section id="importing-and-exporting">
<h2>Importing and Exporting<a class="headerlink" href="#importing-and-exporting" title="Link to this heading"></a></h2>
<p>COLMAP provides several export options for further processing. For full
flexibility, it is recommended to export the reconstruction in COLMAP’s data
format by choosing <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Export</span></code> to export the currently viewed model or
<code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Export</span> <span class="pre">all</span></code> to export all reconstructed models. The model is exported
in the selected folder using separate text files for the reconstructed cameras,
images, and points. When exporting in COLMAP’s data format, you can re- import
the reconstruction for later visualization, image undistortion, or to continue
an existing reconstruction from where it left off (e.g., after importing and
matching new images). To import a model, choose <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Import</span></code> and select the
export folder path. Alternatively, you can also export the model in various
other formats, such as Bundler, VisualSfM <a class="footnote-reference brackets" href="#f1" id="id9" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, PLY, or VRML by choosing
<code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Export</span> <span class="pre">as...</span></code>. COLMAP can visualize plain PLY point cloud files with
RGB information by choosing <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Import</span> <span class="pre">From...</span></code>. Further information about
the format of the exported models can be found <a class="reference internal" href="format.html#output-format"><span class="std std-ref">here</span></a>.</p>
</section>
<section id="dense-reconstruction">
<span id="id10"></span><h2>Dense Reconstruction<a class="headerlink" href="#dense-reconstruction" title="Link to this heading"></a></h2>
<p>After reconstructing a sparse representation of the scene and the camera poses
of the input images, MVS can now recover denser scene geometry. COLMAP has an
integrated dense reconstruction pipeline to produce depth and normal maps for
all registered images, to fuse the depth and normal maps into a dense point
cloud with normal information, and to finally estimate a dense surface from the
fused point cloud using Poisson <a class="reference internal" href="bibliography.html#kazhdan2013" id="id11"><span>[kazhdan2013]</span></a> or Delaunay reconstruction.</p>
<p>To get started, import your sparse 3D model into COLMAP (or select the
reconstructed model after finishing the previous sparse reconstruction steps).
Then, choose <code class="docutils literal notranslate"><span class="pre">Reconstruction</span> <span class="pre">></span> <span class="pre">Multi-view</span> <span class="pre">stereo</span></code> and select an empty or
existing workspace folder, which is used for the output and of all dense
reconstruction results. The first step is to <code class="docutils literal notranslate"><span class="pre">undistort</span></code> the images, second to
compute the depth and normal maps using <code class="docutils literal notranslate"><span class="pre">stereo</span></code>, third to <code class="docutils literal notranslate"><span class="pre">fuse</span></code> the depth
and normals maps to a point cloud, followed by a final, optional point cloud
<code class="docutils literal notranslate"><span class="pre">meshing</span></code> step. During the stereo reconstruction process, the display might
freeze due to heavy compute load and, if your GPU does not have enough memory,
the reconstruction process might ungracefully crash. Please, refer to the FAQ
(<a class="reference internal" href="faq.html#faq-dense-timeout"><span class="std std-ref">freeze</span></a> and <a class="reference internal" href="faq.html#faq-dense-memory"><span class="std std-ref">memory</span></a>) for
information on how to avoid these problems. Note that the reconstructed normals
of the point cloud cannot be directly visualized in COLMAP, but e.g. in Meshlab
by enabling <code class="docutils literal notranslate"><span class="pre">Render</span> <span class="pre">></span> <span class="pre">Show</span> <span class="pre">Normal/Curvature</span></code>. Similarly, the reconstructed
dense surface mesh model must be visualized with external software.</p>
<p>In addition to the internal dense reconstruction functionality, COLMAP exports
to several other dense reconstruction libraries, such as CMVS/PMVS <a class="reference internal" href="bibliography.html#furukawa10" id="id12"><span>[furukawa10]</span></a>
or CMP-MVS <a class="reference internal" href="bibliography.html#jancosek11" id="id13"><span>[jancosek11]</span></a>. Please choose <code class="docutils literal notranslate"><span class="pre">Extras</span> <span class="pre">></span> <span class="pre">Undistort</span> <span class="pre">images</span></code> and select
the appropriate format. The output folders contain the reconstruction and the
undistorted images. In addition, the folders contain sample shell scripts to
perform the dense reconstruction. To run PMVS2, execute the following commands:</p>
<blockquote>
<div><p>./path/to/pmvs2 /path/to/undistortion/folder/pmvs/ option-all</p>
</div></blockquote>
<p>where <cite>/path/to/undistortion/folder</cite> is the folder selected in the undistortion
dialog. Make sure not to forget the trailing slash in
<cite>/path/to/undistortion/folder/pmvs/</cite> in the above command-line arguments.</p>
<p>For large datasets, you probably want to first run CMVS to cluster the scene
into more manageable parts and then run COLMAP or PMVS2. Please, refer to the
sample shell scripts in the undistortion output folder on how to run CMVS in
combination with COLMAP or PMVS2. Moreover, there are a number of external
libraries that support COLMAP’s output:</p>
<ul class="simple">
<li><p><a class="reference external" href="http://www.di.ens.fr/pmvs/">CMVS/PMVS</a> <a class="reference internal" href="bibliography.html#furukawa10" id="id14"><span>[furukawa10]</span></a></p></li>
<li><p><a class="reference external" href="http://ptak.felk.cvut.cz/sfmservice/websfm.pl">CMP-MVS</a> <a class="reference internal" href="bibliography.html#jancosek11" id="id15"><span>[jancosek11]</span></a></p></li>
<li><p><a class="reference external" href="https://github.com/manhofer/Line3Dpp">Line3D++</a> <a class="reference internal" href="bibliography.html#hofer16" id="id16"><span>[hofer16]</span></a>.</p></li>
</ul>
</section>
<section id="database-management">
<span id="id17"></span><h2>Database Management<a class="headerlink" href="#database-management" title="Link to this heading"></a></h2>
<p>You can review and manage the imported cameras, images, and feature matches in
the database management tool. Choose <code class="docutils literal notranslate"><span class="pre">Processing</span> <span class="pre">></span> <span class="pre">Manage</span> <span class="pre">database</span></code>. In the
opening dialog, you can see the list of imported images and cameras. You can
view the features and matches for each image by clicking <code class="docutils literal notranslate"><span class="pre">Show</span> <span class="pre">image</span></code> and
<code class="docutils literal notranslate"><span class="pre">Overlapping</span> <span class="pre">images</span></code>. Individual entries in the database tables can be
modified by double clicking specific cells. Note that any changes to the
database are only effective after clicking <code class="docutils literal notranslate"><span class="pre">Save</span></code>.</p>
<p>To share intrinsic camera parameters between arbitrary groups of images, select
a single or multiple images, choose <code class="docutils literal notranslate"><span class="pre">Set</span> <span class="pre">camera</span></code> and set the <cite>camera_id</cite>,
which corresponds to the unique <cite>camera_id</cite> column in the cameras table. You can
also add new cameras with specific parameters. By setting the
<cite>prior_focal_length</cite> flag to 0 or 1, you can give a hint whether the
reconstruction algorithm should trust the focal length value. In case of a prior
lab calibration, you want to set this value to 1. Without prior knowledge about
the focal length, it is recommended to set this value to <cite>1.25 *
max(width_in_px, height_in_px)</cite>.</p>
<p>The database management tool has only limited functionality and, for full
control over the data, you must directly modify the SQLite database (see
<a class="reference internal" href="database.html#database-format"><span class="std std-ref">Database Format</span></a>). By accessing the database directly,
you can use COLMAP only for feature extraction and matching or you can import
your own features and matches to only use COLMAP’s incremental reconstruction
algorithm.</p>
</section>
<section id="graphical-and-command-line-interface">
<span id="interface"></span><h2>Graphical and Command-line Interface<a class="headerlink" href="#graphical-and-command-line-interface" title="Link to this heading"></a></h2>
<p>Most of COLMAP’s features are accessible from both the graphical and the
command-line interface, which are both embedded in the same executable. You can
provide the options directly as command-line arguments or you can provide a
<cite>.ini</cite> project configuration file containing the options using the
<code class="docutils literal notranslate"><span class="pre">--project_path</span> <span class="pre">path/to/project.ini</span></code> argument. To start the GUI application,
please execute <code class="docutils literal notranslate"><span class="pre">colmap</span> <span class="pre">gui</span></code> or directly specify a project configuration as
<code class="docutils literal notranslate"><span class="pre">colmap</span> <span class="pre">gui</span> <span class="pre">--project_path</span> <span class="pre">path/to/project.ini</span></code> to avoid tedious selection in
the GUI. To list the different commands available from the command-line, execute
<code class="docutils literal notranslate"><span class="pre">colmap</span> <span class="pre">help</span></code>. For example, to run feature extraction from the command-line,
you must execute <code class="docutils literal notranslate"><span class="pre">colmap</span> <span class="pre">feature_extractor</span></code>. The <a class="reference internal" href="gui.html#gui"><span class="std std-ref">graphical user
interface</span></a> and <a class="reference internal" href="cli.html#cli"><span class="std std-ref">command-line Interface</span></a> sections provide more
details about the available commands.</p>
<p class="rubric">Footnotes</p>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="f1" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id9">1</a><span class="fn-bracket">]</span></span>
<p>VisualSfM’s <a class="reference internal" href="bibliography.html#wu13" id="id18"><span>[wu13]</span></a> projection model applies the distortion to the
measurements and COLMAP to the projection, hence the exported NVM file is
not fully compatible with VisualSfM.</p>
</aside>
</aside>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="install.html" class="btn btn-neutral float-left" title="Installation" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="database.html" class="btn btn-neutral float-right" title="Database Format" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>© Copyright 2024, Johannes L. Schoenberger.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>