NDEVR
API Documentation
PhotogrammetryDense.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2026, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: DronePhotogrammetry
28File: PhotogrammetryDense
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include "PhotogrammetryOptions.h"
35#include "PhotogrammetryGPSAlign.h"
36#include <NDEVR/BaseValues.h>
37#include <NDEVR/Buffer.h>
38#include <NDEVR/File.h>
39#include <NDEVR/Log.h>
40#include <NDEVR/String.h>
41#include <NDEVR/Vector.h>
42#include <NDEVR/Vertex.h>
43
44#include <functional>
45#include <unordered_map>
46#include <array>
47
48// Forward declarations
49namespace openMVG { namespace sfm { struct SfM_Data; } }
50namespace MVS { class Interface; class Scene; }
51
52namespace NDEVR
53{
55
61 class DRONE_PHOTOGRAMMETRY_API PhotogrammetryDense
62 {
63 public:
64 using ProgressFn = std::function<void(fltp04)>;
65 using ResultFn = std::function<void(PhotogrammetryResult)>;
66
72 static void run(
73 const openMVG::sfm::SfM_Data& sfm_data,
74 const Buffer<File>& dense_images,
75 const Buffer<Vector<2, uint04>>& dense_sizes,
76 const GPSAlignmentResult& gps_alignment,
77 const std::unordered_map<uint32_t, std::array<double, 3>>& gps_lla,
78 const PhotogrammetryOptions& options,
79 const File& temp_folder,
80 LogPtr log,
81 ProgressFn progress_fn,
82 ResultFn result_fn,
83 const bool& cancel_flag,
84 const Buffer<bool>& dense_keyframes = Buffer<bool>());
85
86 private:
89 struct MVSInterfaceMappings
90 {
91 std::unordered_map<uint32_t, uint32_t> view_id_to_mvs_idx;
92 std::unordered_map<uint32_t, uint32_t> mvs_idx_to_view_id;
93 Vector<3, fltp08> sfm_centroid;
94 };
95 static bool buildMVSInterface(
96 MVS::Interface& mvs_interface,
97 MVSInterfaceMappings& mappings,
98 const openMVG::sfm::SfM_Data& sfm_data,
99 const Buffer<File>& dense_images,
100 const Buffer<Vector<2, uint04>>& dense_sizes,
101 LogPtr log);
102
104 static bool initializeMVSScene(
105 MVS::Scene& mvs_scene,
106 const MVS::Interface& mvs_interface,
107 const File& temp_mvs_file,
108 uint04 mvs_image_count,
109 LogPtr log);
110
112 static void configureOptDenseParameters(
113 const MVS::Interface& mvs_interface,
114 const PhotogrammetryOptions& options,
115 LogPtr log);
116
118 static bool runCpuDenseReconstruction(
119 MVS::Scene& mvs_scene,
120 const File& temp_mvs_file,
121 LogPtr log);
122
123#if defined(VULKAN_COMPUTE_DLL)
125 static void runGpuDepthEstimation(
126 const MVS::Interface& mvs_interface,
127 MVS::Scene& mvs_scene,
128 const File& temp_mvs_file,
129 LogPtr log,
130 ProgressFn progress_fn,
131 const bool& cancel_flag,
132 DenseReconstructionMode dense_mode,
133 const Buffer<bool>& dense_keyframe_mask = Buffer<bool>());
134
136 static void fuseGPUDepthMaps(
137 MVS::Scene& mvs_scene,
138 const MVS::Interface& mvs_interface,
139 const File& temp_mvs_file,
140 LogPtr log);
141#endif
142
144 static void buildResultWithGPSAlignment(
145 PhotogrammetryResult& result,
146 const MVS::Scene& mvs_scene,
147 const MVS::Interface& mvs_interface,
148 const MVSInterfaceMappings& mappings,
149 const GPSAlignmentResult& gps_alignment,
150 const std::unordered_map<uint32_t, std::array<double, 3>>& gps_lla,
151 LogPtr log);
152
154 static void buildResultWithUprightOrientation(
155 PhotogrammetryResult& result,
156 const MVS::Scene& mvs_scene,
157 const MVS::Interface& mvs_interface,
158 const openMVG::sfm::SfM_Data& sfm_data,
159 LogPtr log);
160 };
161}
The primary namespace for the NDEVR SDK.
Holds the raw output of a completed photogrammetry run before it is committed to the scene.