NDEVR
API Documentation
PhotogrammetryRunner.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: PhotogrammetryRunner
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include "PhotogrammetryOptions.h"
35#include <NDEVR/BaseValues.h>
36#include <NDEVR/Buffer.h>
37#include <NDEVR/File.h>
38#include <NDEVR/Log.h>
39#include <NDEVR/String.h>
40#include <NDEVR/Vertex.h>
41
42#include <array>
43#include <functional>
44#include <unordered_map>
45
46// Forward declarations
47namespace openMVG { namespace sfm { struct SfM_Data; } }
48
49namespace NDEVR
50{
67
72 {
73 uint01 r = 0;
74 uint01 g = 0;
75 uint01 b = 0;
76 };
77
91
105 class DRONE_PHOTOGRAMMETRY_API PhotogrammetryRunner
106 {
107 public:
108 explicit PhotogrammetryRunner(const PhotogrammetryOptions& options, LogPtr log);
109
112 void setProgressCallback(std::function<void(PhotogrammetryStage stage, fltp04 fraction)> callback);
113
115 void setResultCallback(std::function<void(PhotogrammetryResult)> callback);
116
118 void cancel();
119
121 void run();
122
124 PhotogrammetryStage lastStage() const { return m_last_stage; }
125
126 private:
127 Buffer<File> listImages() const;
128 Buffer<File> prepareWorkingImages(const Buffer<File>& originals);
129 Buffer<File> prepareDenseImages(const Buffer<File>& originals, const Buffer<File>& feature_images);
130 void reportProgress(PhotogrammetryStage stage, fltp04 fraction);
131
137 Buffer<bool> selectDenseKeyframes(
138 const openMVG::sfm::SfM_Data& sfm_data,
139 const std::unordered_map<uint32_t, std::array<double, 3>>& gps_lla) const;
140
141 PhotogrammetryOptions m_options;
142 LogPtr m_log;
143 std::function<void(PhotogrammetryStage, fltp04)> m_progress_callback;
144 std::function<void(PhotogrammetryResult)> m_result_callback;
146 bool m_cancel_requested = false;
147
148 File m_temp_folder;
149 File m_dense_temp_folder;
150 Buffer<fltp08> m_image_scales;
151 Buffer<Vector<2, uint04>> m_working_sizes;
152 Buffer<fltp08> m_dense_scales;
153 Buffer<Vector<2, uint04>> m_dense_sizes;
154 };
155}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
A light-weight wrapper that will be a no-op if there is not a valid log reference,...
Persistent settings for a drone photogrammetry processing run.
void setResultCallback(std::function< void(PhotogrammetryResult)> callback)
Called once when the pipeline finishes successfully with the full result.
void setProgressCallback(std::function< void(PhotogrammetryStage stage, fltp04 fraction)> callback)
Called whenever the active stage or progress within a stage changes.
PhotogrammetryStage lastStage() const
Returns the stage at which the last run ended (e_done, e_cancelled, or e_failed).
void cancel()
Request cancellation. The runner will stop at the next safe checkpoint.
void run()
Run the full pipeline. Blocks the calling thread.
The primary namespace for the NDEVR SDK.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
PhotogrammetryStage
Describes which stage of the photogrammetry pipeline is currently running.
@ e_extracting_features
Running per-image feature extraction (SIFT / AKAZE).
@ e_dense_reconstruction
MVS: generating dense point cloud.
@ e_cancelled
User cancelled the run.
@ e_done
Pipeline completed successfully.
@ e_sfm
Structure-from-Motion: recovering camera poses + sparse cloud.
@ e_failed
An error occurred; see log for details.
@ e_matching_features
Finding correspondences between image pairs.
@ e_listing_images
Scanning input folder and reading EXIF metadata.
@ e_building_scene
Converting output into NDEVR DesignObjects.
RGB color for a reconstructed point.
Holds the raw output of a completed photogrammetry run before it is committed to the scene.
Buffer< PhotogrammetryPointColor > point_colors
RGB per point.
Buffer< Matrix< fltp08 > > camera_transforms
One view matrix per recovered image pose.
Buffer< String > camera_image_names
Corresponding image filename per pose.
Buffer< Vertex< 3, fltp08 > > camera_gps_lla
Per-camera GPS [lat, lon, alt] WGS84 (Invalid if no GPS).
Buffer< Vertex< 3, fltp08 > > point_positions
World-space XYZ (double for georef accuracy).
Buffer< Vertex< 3, fltp08 > > sparse_positions
Sparse SfM keypoints in world-space (for debug visualization).