ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
AutomaticReconstructionController.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // Thin wrapper around colmap::AutomaticReconstructionController
11 // This allows app to reuse the implementation from libs/Reconstruction
12 // while adding visualization-specific data collection
13 
14 #include "controllers/automatic_reconstruction.h"
15 #include "util/ply.h"
16 
17 namespace colmap {
18 class Reconstruction;
19 }
20 
21 namespace colmap {
22 class ReconstructionManager;
23 }
24 
25 namespace cloudViewer {
26 
27 // app-specific wrapper that extends colmap's AutomaticReconstructionController
28 // Main additions:
29 // 1. Data collection for UI visualization via hook methods
30 // 2. autoVisualization option for automatic scene integration
32  : public colmap::AutomaticReconstructionController {
33 public:
34  // Extend Options with app-specific settings
35  struct Options : public colmap::AutomaticReconstructionController::Options {
36  // Whether to add the reconstruction results to DBRoot automatically
37  bool autoVisualization = true;
38  };
39 
41  const Options& options,
42  colmap::ReconstructionManager* reconstruction_manager);
43 
44  // app-specific: Public data for UI visualization
45  // These collect results during reconstruction for display
46  std::vector<std::vector<colmap::PlyPoint>> fused_points_;
47  std::vector<std::string> meshing_paths_;
48  std::vector<std::string> textured_paths_;
49  bool texturing_success_ = false;
50 
51 protected:
52  // Override hook methods to collect data for visualization
54  size_t reconstruction_idx,
55  const std::vector<colmap::PlyPoint>& points) override;
56  void OnMeshGenerated(size_t reconstruction_idx,
57  const std::string& mesh_path) override;
58  void OnTexturedMeshGenerated(size_t reconstruction_idx,
59  const std::string& textured_path) override;
60 
61  // Override to initialize data containers
62  void RunDenseMapper() override;
63 
64 private:
65  const Options ecv_options_;
66 };
67 
68 } // namespace cloudViewer
int points
void OnTexturedMeshGenerated(size_t reconstruction_idx, const std::string &textured_path) override
void OnMeshGenerated(size_t reconstruction_idx, const std::string &mesh_path) override
void OnFusedPointsGenerated(size_t reconstruction_idx, const std::vector< colmap::PlyPoint > &points) override
AutomaticReconstructionController(const Options &options, colmap::ReconstructionManager *reconstruction_manager)
std::vector< std::vector< colmap::PlyPoint > > fused_points_
Generic file read and write utility for python interface.