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
colmap::mvs::Mat::GetWidth
size_t GetWidth() const
Definition: mat.h:71
QtCompat::endl
QTextStream & endl(QTextStream &stream)
Definition: QtCompat.h:718
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(TestEmpty)
Definition: mat_test.cc:39
colmap::mvs::PoissonMeshingOptions::depth
int depth
Definition: meshing.h:27
cloudViewer::core::make_pair
CLOUDVIEWER_HOST_DEVICE Pair< First, Second > make_pair(const First &_first, const Second &_second)
Definition: SlabTraits.h:49
colmap::mvs::DelaunayMeshingOptions::Check
bool Check() const
Definition: meshing.cc:108
option_manager.h
colmap::mvs::DelaunayMeshingOptions
Definition: meshing.h:46
colmap::mvs::PoissonMeshingOptions::trim
double trim
Definition: meshing.h:38
position
math::float3 position
Definition: LineSetBuffers.cpp:44
colmap::ReadPly
std::vector< PlyPoint > ReadPly(const std::string &path)
Definition: ply.cc:43
colmap::JoinPaths
std::string JoinPaths(T const &... paths)
Definition: misc.h:128
colmap::mvs::DelaunayMeshingOptions::visibility_sigma
double visibility_sigma
Definition: meshing.h:59
colmap::mvs::DelaunayMeshingOptions::max_proj_dist
double max_proj_dist
Definition: meshing.h:49
graph_cut.h
colmap::mvs::Mat::GetDepth
size_t GetDepth() const
Definition: mat.h:81
colmap::WriteBinaryPlyMesh
void WriteBinaryPlyMesh(const std::string &path, const PlyMesh &mesh)
Definition: ply.cc:448
ply.h
CHECK_OPTION_GE
#define CHECK_OPTION_GE(val1, val2)
Definition: logging.h:33
mat.h
colmap::mvs::Mat::Fill
void Fill(const T value)
Definition: mat.h:131
testing.h
CHECK_OPTION_LE
#define CHECK_OPTION_LE(val1, val2)
Definition: logging.h:31
result
core::Tensor result
Definition: VtkUtils.cpp:76
meshing.h
colmap::mvs
Definition: consistency_graph.cc:41
colmap::mvs::DelaunayMeshingOptions::max_side_length_percentile
double max_side_length_percentile
Definition: meshing.h:74
colmap::mvs::PoissonMeshingOptions::num_threads
int num_threads
Definition: meshing.h:41
random.h
colmap::mvs::DelaunayMeshingOptions::distance_sigma_factor
double distance_sigma_factor
Definition: meshing.h:64
colmap::mvs::PoissonMeshingOptions::point_weight
double point_weight
Definition: meshing.h:20
colmap::mvs::DelaunayMeshingOptions::max_side_length_factor
double max_side_length_factor
Definition: meshing.h:73
CHECK_OPTION_NE
#define CHECK_OPTION_NE(val1, val2)
Definition: logging.h:30
colmap::mvs::DelaunayMeshingOptions::max_depth_dist
double max_depth_dist
Definition: meshing.h:54
cloudViewer::t::geometry::path
static const std::string path
Definition: PointCloud.cpp:59
e
const double * e
Definition: essential_matrix_poly.h:10
misc.h
Eigen::Matrix3x4f
Matrix< float, 3, 4 > Matrix3x4f
Definition: types.h:38
colmap::mvs::PoissonMeshingOptions
Definition: meshing.h:15
colmap::mvs::Mat::Set
void Set(const size_t row, const size_t col, const T value)
Definition: mat.h:118
timer.h
reconstruction.h
image
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:184
cloudViewer::ml::contrib::Intersection
CLOUDVIEWER_HOST_DEVICE int Intersection(const Point &p1, const Point &p0, const Point &q1, const Point &q0, Point &ans)
Definition: IoUImpl.h:78
points
int points
Definition: FileIOFactory.cpp:144
colmap::Shuffle
void Shuffle(const uint32_t num_to_shuffle, std::vector< T > *elems)
Definition: random.h:96
colmap::kInvalidCameraId
const camera_t kInvalidCameraId
Definition: types.h:75
colmap::mvs::Mat::GetNumBytes
size_t GetNumBytes() const
Definition: mat.h:86
threading.h
colmap::mvs::Mat::Get
T Get(const size_t row, const size_t col, const size_t slice=0) const
Definition: mat.h:91
colmap::mvs::PoissonMeshingOptions::Check
bool Check() const
Definition: meshing.cc:98
colmap::GetEffectiveNumThreads
int GetEffectiveNumThreads(const int num_threads)
Definition: threading.cc:269
std
Definition: Eigen.h:85
colmap::mvs::Mat
Definition: mat.h:21
logging.h
colmap
Definition: AutomaticReconstructionController.h:17
colmap::camera_t
uint32_t camera_t
Definition: types.h:58
colmap::mvs::DelaunayMeshingOptions::quality_regularization
double quality_regularization
Definition: meshing.h:67
colmap::mvs::PoissonMeshingOptions::color
double color
Definition: meshing.h:33
CHECK_OPTION_GT
#define CHECK_OPTION_GT(val1, val2)
Definition: logging.h:34
colmap::StringPrintf
std::string StringPrintf(const char *format,...)
Definition: string.cc:131
colmap::mvs::Mat::GetSlice
void GetSlice(const size_t row, const size_t col, T *values) const
Definition: mat.h:96
colmap::Percentile
T Percentile(const std::vector< T > &elems, const double p)
Definition: math.h:209
colmap::mvs::Mat::GetHeight
size_t GetHeight() const
Definition: mat.h:76
patch::to_string
std::string to_string(const T &n)
Definition: Common.h:20
colmap::mvs::PoissonMeshing
bool PoissonMeshing(const PoissonMeshingOptions &options, const std::string &input_path, const std::string &output_path)
Definition: meshing.cc:123
colmap::mvs::DelaunayMeshingOptions::num_threads
int num_threads
Definition: meshing.h:77
endian.h