ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
meshing.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 #include <string>
11 
12 namespace colmap {
13 namespace mvs {
14 
16  // This floating point value specifies the importance that interpolation of
17  // the point samples is given in the formulation of the screened Poisson
18  // equation. The results of the original (unscreened) Poisson Reconstruction
19  // can be obtained by setting this value to 0.
20  double point_weight = 1.0;
21 
22  // This integer is the maximum depth of the tree that will be used for
23  // surface reconstruction. Running at depth d corresponds to solving on a
24  // voxel grid whose resolution is no larger than 2^d x 2^d x 2^d. Note that
25  // since the reconstructor adapts the octree to the sampling density, the
26  // specified reconstruction depth is only an upper bound.
27  int depth = 13;
28 
29  // If specified, the reconstruction code assumes that the input is equipped
30  // with colors and will extrapolate the color values to the vertices of the
31  // reconstructed mesh. The floating point value specifies the relative
32  // importance of finer color estimates over lower ones.
33  double color = 32.0;
34 
35  // This floating point values specifies the value for mesh trimming. The
36  // subset of the mesh with signal value less than the trim value is
37  // discarded.
38  double trim = 10.0;
39 
40  // The number of threads used for the Poisson reconstruction.
41  int num_threads = -1;
42 
43  bool Check() const;
44 };
45 
47  // Unify input points into one cell in the Delaunay triangulation that fall
48  // within a reprojected radius of the given pixels.
49  double max_proj_dist = 20.0;
50 
51  // Maximum relative depth difference between input point and a vertex of an
52  // existing cell in the Delaunay triangulation, otherwise a new vertex is
53  // created in the triangulation.
54  double max_depth_dist = 0.05;
55 
56  // The standard deviation of wrt. the number of images seen by each point.
57  // Increasing this value decreases the influence of points seen in few
58  // images.
59  double visibility_sigma = 3.0;
60 
61  // The factor that is applied to the computed distance sigma, which is
62  // automatically computed as the 25th percentile of edge lengths. A higher
63  // value will increase the smoothness of the surface.
64  double distance_sigma_factor = 1.0;
65 
66  // A higher quality regularization leads to a smoother surface.
67  double quality_regularization = 1.0;
68 
69  // Filtering thresholds for outlier surface mesh faces. If the longest side
70  // of a mesh face (longest out of 3) exceeds the side lengths of all faces
71  // at a certain percentile by the given factor, then it is considered an
72  // outlier mesh face and discarded.
73  double max_side_length_factor = 25.0;
75 
76  // The number of threads to use for reconstruction. Default is all threads.
77  int num_threads = -1;
78 
79  bool Check() const;
80 };
81 
82 // Perform Poisson surface reconstruction and return true if successful.
83 bool PoissonMeshing(const PoissonMeshingOptions& options,
84  const std::string& input_path,
85  const std::string& output_path);
86 
87 #ifdef CGAL_ENABLED
88 
89 // Delaunay meshing of sparse and dense COLMAP reconstructions. This is an
90 // implementation of the approach described in:
91 //
92 // P. Labatut, J‐P. Pons, and R. Keriven. "Robust and efficient surface
93 // reconstruction from range data". Computer graphics forum, 2009.
94 //
95 // In case of sparse input, the path should point to a sparse COLMAP
96 // reconstruction. In case of dense input, the path should point to a dense
97 // COLMAP workspace folder, which has been fully processed by the stereo and
98 // fusion pipeline.
99 void SparseDelaunayMeshing(const DelaunayMeshingOptions& options,
100  const std::string& input_path,
101  const std::string& output_path);
102 void DenseDelaunayMeshing(const DelaunayMeshingOptions& options,
103  const std::string& input_path,
104  const std::string& output_path);
105 
106 #endif // CGAL_ENABLED
107 
108 } // namespace mvs
109 } // namespace colmap
bool PoissonMeshing(const PoissonMeshingOptions &options, const std::string &input_path, const std::string &output_path)
Definition: meshing.cc:123