40 #ifndef PCL_SURFACE_IMPL_POISSON_H_
41 #define PCL_SURFACE_IMPL_POISSON_H_
43 #include <pcl/surface/poisson.h>
45 #include <pcl/common/vector_average.h>
46 #include <pcl/Vertices.h>
48 #include <pcl/surface/3rdparty/poisson4/octree_poisson.h>
49 #include <pcl/surface/3rdparty/poisson4/sparse_matrix.h>
50 #include <pcl/surface/3rdparty/poisson4/function_data.h>
51 #include <pcl/surface/3rdparty/poisson4/ppolynomial.h>
52 #include <pcl/surface/3rdparty/poisson4/multi_grid_octree_data.h>
53 #include <pcl/surface/3rdparty/poisson4/geometry.h>
55 #define MEMORY_ALLOCATOR_BLOCK_SIZE 1<<12
62 template <
typename Po
intNT>
70 , samples_per_node_ (1.0)
72 , output_polygons_ (false)
73 , no_reset_samples_ (false)
74 , no_clip_tree_ (false)
79 , non_adaptive_weights_ (false)
80 , show_residual_ (false)
82 , solver_accuracy_ (1e-3f)
88 template <
typename Po
intNT>
92 template <
typename Po
intNT>
void
97 threads_ = omp_get_num_procs();
106 template <
typename Po
intNT>
template <
int Degree>
void
120 if (solver_divide_ < min_depth_)
122 PCL_WARN (
"[pcl::Poisson] solver_divide_ must be at least as large as min_depth_: %d >= %d\n", solver_divide_, min_depth_);
123 solver_divide_ = min_depth_;
125 if (iso_divide_< min_depth_)
127 PCL_WARN (
"[pcl::Poisson] iso_divide_ must be at least as large as min_depth_: %d >= %d\n", iso_divide_, min_depth_);
128 iso_divide_ = min_depth_;
133 kernel_depth_ = depth_ - 2;
140 int point_count = tree.template setTree<PointNT> (input_, depth_, min_depth_, kernel_depth_, samples_per_node_,
141 scale_, center, scale, confidence_, point_weight_, !non_adaptive_weights_);
147 PCL_DEBUG (
"Input Points: %d\n" , point_count );
158 tree.GetMCIsoTriangles (iso_value, iso_divide_, &mesh, 0, 1, manifold_, output_polygons_);
163 template <
typename Po
intNT>
void
174 execute<1> (mesh, center, scale);
179 execute<2> (mesh, center, scale);
184 execute<3> (mesh, center, scale);
189 execute<4> (mesh, center, scale);
194 execute<5> (mesh, center, scale);
199 PCL_ERROR (stderr,
"Degree %d not supported\n", degree_);
207 for (
int i = 0; i < static_cast<int>(mesh.
inCorePoints.size ()); i++)
225 std::vector<poisson::CoredVertexIndex> polygon;
230 v.
vertices.resize (polygon.size ());
232 for (
int i = 0; i < static_cast<int> (polygon.size ()); ++i)
233 if (polygon[i].inCore )
243 template <
typename Po
intNT>
void
245 std::vector<pcl::Vertices> &polygons)
255 execute<1> (mesh, center, scale);
260 execute<2> (mesh, center, scale);
265 execute<3> (mesh, center, scale);
270 execute<4> (mesh, center, scale);
275 execute<5> (mesh, center, scale);
280 PCL_ERROR (stderr,
"Degree %d not supported\n", degree_);
288 for (
int i = 0; i < static_cast<int>(mesh.
inCorePoints.size ()); i++)
306 std::vector<poisson::CoredVertexIndex> polygon;
311 v.
vertices.resize (polygon.size ());
313 for (
int i = 0; i < static_cast<int> (polygon.size ()); ++i)
314 if (polygon[i].inCore )
324 #define PCL_INSTANTIATE_Poisson(T) template class PCL_EXPORTS pcl::Poisson<T>;
void resize(std::size_t count)
Resizes the container to contain count elements.
The Poisson surface reconstruction algorithm.
void setThreads(int threads)
Set the number of threads to use.
Poisson()
Constructor that sets all the parameters to working default values.
void performReconstruction(pcl::PolygonMesh &output) override
Create the surface.
~Poisson() override
Destructor.
std::vector< Point3D< float > > inCorePoints
int nextPolygon(std::vector< CoredVertexIndex > &vertices)
int outOfCorePointCount(void)
int nextOutOfCorePoint(Point3D< float > &p)
static void SetAllocator(int blockSize)
void RefineBoundary(int subdivisionDepth)
void setBSplineData(int maxDepth, Real normalSmooth=-1, bool reflectBoundary=false)
int LaplacianMatrixIteration(int subdivideDepth, bool showResidual, int minIters, double accuracy)
void SetLaplacianConstraints(void)
static double maxMemoryUsage
Define standard C methods and C++ classes that are common to all methods.
void toPCLPointCloud2(const pcl::PointCloud< PointT > &cloud, pcl::PCLPointCloud2 &msg)
Convert a pcl::PointCloud<T> object to a PCLPointCloud2 binary data blob.
std::vector< ::pcl::Vertices > polygons
::pcl::PCLPointCloud2 cloud
Describes a set of vertices in a polygon mesh, by basically storing an array of indices.