Debian Codegraph @

doc/viewer.rst

raw
1 :html_theme.sidebar_secondary.remove: true
2 :og:description: Inspect COLMAP sparse reconstructions directly in your browser with an interactive, private, local-only 3D viewer.
3
4 .. meta::
5 :description: Inspect binary COLMAP sparse reconstructions directly in your browser with an interactive, private, local-only Three.js viewer.
6
7 3D Viewer
8 =========
9
10 Open a binary COLMAP sparse reconstruction directly in your browser. Processing
11 happens locally: reconstruction files and images are never uploaded.
12
13 The 3D Viewer follows the visual conventions and model-view controls of the
14 native :ref:`Graphical User Interface <gui>`, including navigation, point and
15 image selection, observation inspection, and point/camera scaling. It is a
16 read-only inspection tool with intentionally less functionality than the native
17 GUI: it does not run reconstruction pipelines, edit models, or visualize dense
18 point clouds and meshes.
19
20 .. raw:: html
21
22 <link rel="stylesheet" href="_static/viewer/viewer.css">
23 <div id="colmap-viewer-root">
24 <p>The interactive viewer is unavailable in this documentation build.</p>
25 <noscript>This viewer requires JavaScript.</noscript>
26 </div>
27 <script type="module" src="_static/viewer/viewer.js"></script>
28
29
30 Supported Inputs
31 ----------------
32
33 Drop a sparse model folder containing ``cameras.bin``, ``images.bin``, and
34 ``points3D.bin``, or drop a workspace containing one or more sparse models.
35 Current reconstructions with ``rigs.bin`` and ``frames.bin`` and legacy binary
36 reconstructions are supported. If several models are found, choose one from the
37 toolbar.
38
39 To inspect image observations and reprojections, drop a workspace that also
40 contains the source image tree. You can also drop the images folder after the
41 model has loaded. Image paths are matched against the relative names recorded
42 in ``images.bin``.
43
44
45 Controls
46 --------
47
48 - **Rotate:** left-click and drag.
49 - **Pan:** right-click and drag.
50 - **Zoom:** scroll.
51 - **Point size:** <CTRL>-scroll (<CMD>-scroll) or use the toolbar.
52 - **Camera size:** <ALT>-scroll or use the toolbar.
53 - **Select:** double-click a point or camera.
54 - **Clear selection:** double-click the background or use the toolbar.
55
56 The viewer requires a current desktop browser with WebGL2. Folder selection is
57 available as a fallback when directory drag-and-drop is not supported by the
58 browser.
59
60
61 Reusing the Viewer
62 ------------------
63
64 The viewer is also an ES module component. Build it with ``npm run build`` in
65 the ``doc`` directory, copy the complete ``_static/viewer`` directory so that
66 the parser worker remains beside the module, and include both generated assets:
67
68 .. code-block:: html
69
70 <link rel="stylesheet" href="/viewer/viewer.css">
71 <div id="my-viewer"></div>
72 <input id="model-folder" type="file" webkitdirectory multiple>
73 <script type="module">
74 import {mountColmapViewer} from "/viewer/component.js";
75
76 const viewer = mountColmapViewer(document.querySelector("#my-viewer"));
77 document.querySelector("#model-folder").addEventListener("change", async event => {
78 const entries = [...event.target.files].map(file => ({
79 path: file.webkitRelativePath || file.name,
80 file,
81 }));
82 await viewer.load(entries);
83 });
84
85 // viewer.load() also accepts an already parsed Reconstruction object.
86 // Call viewer.clear() or viewer.dispose() when appropriate.
87 </script>
88
89 Each ``LocalFile`` entry has the shape ``{path, file}``, where ``path`` is the
90 file's relative path and ``file`` is a browser ``File`` object. Multiple
91 component instances can coexist on one page. The TypeScript source also exports
92 the mount settings and lifecycle types.
93
94 When embedding the component on another website, please include visible
95 attribution to the `COLMAP project <https://colmap.github.io/>`_ and reproduce
96 the full :doc:`COLMAP new BSD license notice <license>` in the website's legal
97 or third-party notices. Also retain the bundled
98 `Three.js license notice <_static/viewer-licenses.txt>`_ for that dependency.