Point Cloud Library (PCL)  1.14.1-dev
List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions
pcl::GridProjection< PointNT > Class Template Reference

Grid projection surface reconstruction method. More...

#include <pcl/surface/grid_projection.h>

+ Inheritance diagram for pcl::GridProjection< PointNT >:
+ Collaboration diagram for pcl::GridProjection< PointNT >:

Classes

struct  Leaf
 Data leaf. More...
 

Public Types

using Ptr = shared_ptr< GridProjection< PointNT > >
 
using ConstPtr = shared_ptr< const GridProjection< PointNT > >
 
using PointCloudPtr = typename pcl::PointCloud< PointNT >::Ptr
 
using KdTree = pcl::KdTree< PointNT >
 
using KdTreePtr = typename KdTree::Ptr
 
using HashMap = std::unordered_map< int, Leaf, std::hash< int >, std::equal_to<>, Eigen::aligned_allocator< std::pair< const int, Leaf > >>
 
- Public Types inherited from pcl::SurfaceReconstruction< PointNT >
using Ptr = shared_ptr< SurfaceReconstruction< PointNT > >
 
using ConstPtr = shared_ptr< const SurfaceReconstruction< PointNT > >
 
- Public Types inherited from pcl::PCLSurfaceBase< PointInT >
using Ptr = shared_ptr< PCLSurfaceBase< PointInT > >
 
using ConstPtr = shared_ptr< const PCLSurfaceBase< PointInT > >
 
using KdTree = pcl::search::Search< PointInT >
 
using KdTreePtr = typename KdTree::Ptr
 
- Public Types inherited from pcl::PCLBase< PointInT >
using PointCloud = pcl::PointCloud< PointInT >
 
using PointCloudPtr = typename PointCloud::Ptr
 
using PointCloudConstPtr = typename PointCloud::ConstPtr
 
using PointIndicesPtr = PointIndices::Ptr
 
using PointIndicesConstPtr = PointIndices::ConstPtr
 

Public Member Functions

 GridProjection ()
 Constructor. More...
 
 GridProjection (double in_resolution)
 Constructor. More...
 
 ~GridProjection () override
 Destructor. More...
 
void setResolution (double resolution)
 Set the size of the grid cell. More...
 
double getResolution () const
 
void setPaddingSize (int padding_size)
 When averaging the vectors, we find the union of all the input data points within the padding area,and do a weighted average. More...
 
int getPaddingSize () const
 
void setNearestNeighborNum (int k)
 Set this only when using the k nearest neighbors search instead of finding the point union. More...
 
int getNearestNeighborNum () const
 
void setMaxBinarySearchLevel (int max_binary_search_level)
 Binary search is used in projection. More...
 
int getMaxBinarySearchLevel () const
 
const HashMapgetCellHashMap () const
 
const std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > & getVectorAtDataPoint () const
 
const std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > & getSurface () const
 
- Public Member Functions inherited from pcl::SurfaceReconstruction< PointNT >
 SurfaceReconstruction ()=default
 Constructor. More...
 
 ~SurfaceReconstruction () override=default
 Destructor. More...
 
void reconstruct (pcl::PolygonMesh &output) override
 Base method for surface reconstruction for all points given in <setInputCloud (), setIndices ()> More...
 
virtual void reconstruct (pcl::PointCloud< PointNT > &points, std::vector< pcl::Vertices > &polygons)
 Base method for surface reconstruction for all points given in <setInputCloud (), setIndices ()> More...
 
- Public Member Functions inherited from pcl::PCLSurfaceBase< PointInT >
 PCLSurfaceBase ()
 Empty constructor. More...
 
 ~PCLSurfaceBase () override=default
 Empty destructor. More...
 
void setSearchMethod (const KdTreePtr &tree)
 Provide an optional pointer to a search object. More...
 
KdTreePtr getSearchMethod ()
 Get a pointer to the search method used. More...
 
- Public Member Functions inherited from pcl::PCLBase< PointInT >
 PCLBase ()
 Empty constructor. More...
 
 PCLBase (const PCLBase &base)
 Copy constructor. More...
 
virtual ~PCLBase ()=default
 Destructor. More...
 
virtual void setInputCloud (const PointCloudConstPtr &cloud)
 Provide a pointer to the input dataset. More...
 
PointCloudConstPtr const getInputCloud () const
 Get a pointer to the input point cloud dataset. More...
 
virtual void setIndices (const IndicesPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (const IndicesConstPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (const PointIndicesConstPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (std::size_t row_start, std::size_t col_start, std::size_t nb_rows, std::size_t nb_cols)
 Set the indices for the points laying within an interest region of the point cloud. More...
 
IndicesPtr getIndices ()
 Get a pointer to the vector of indices used. More...
 
IndicesConstPtr const getIndices () const
 Get a pointer to the vector of indices used. More...
 
const PointInT & operator[] (std::size_t pos) const
 Override PointCloud operator[] to shorten code. More...
 

Protected Member Functions

void getBoundingBox ()
 Get the bounding box for the input data points, also calculating the cell size, and the gaussian scale factor. More...
 
bool reconstructPolygons (std::vector< pcl::Vertices > &polygons)
 The actual surface reconstruction method. More...
 
void performReconstruction (pcl::PolygonMesh &output) override
 Create the surface. More...
 
void performReconstruction (pcl::PointCloud< PointNT > &points, std::vector< pcl::Vertices > &polygons) override
 Create the surface. More...
 
void scaleInputDataPoint (double scale_factor)
 When the input data points don't fill into the 1*1*1 box, scale them so that they can be filled in the unit box. More...
 
void getCellIndex (const Eigen::Vector4f &p, Eigen::Vector3i &index) const
 Get the 3d index (x,y,z) of the cell based on the location of the cell. More...
 
void getCellCenterFromIndex (const Eigen::Vector3i &index, Eigen::Vector4f &center) const
 Given the 3d index (x, y, z) of the cell, get the coordinates of the cell center. More...
 
void getVertexFromCellCenter (const Eigen::Vector4f &cell_center, std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > &pts) const
 Given cell center, caluate the coordinates of the eight vertices of the cell. More...
 
int getIndexIn1D (const Eigen::Vector3i &index) const
 Given an index (x, y, z) in 3d, translate it into the index in 1d. More...
 
void getIndexIn3D (int index_1d, Eigen::Vector3i &index_3d) const
 Given an index in 1d, translate it into the index (x, y, z) in 3d. More...
 
void fillPad (const Eigen::Vector3i &index)
 For a given 3d index of a cell, test whether the cells within its padding area exist in the hash table, if no, create an entry for that cell. More...
 
void getDataPtsUnion (const Eigen::Vector3i &index, pcl::Indices &pt_union_indices)
 Obtain the index of a cell and the pad size. More...
 
void createSurfaceForCell (const Eigen::Vector3i &index, pcl::Indices &pt_union_indices)
 Given the index of a cell, exam it's up, left, front edges, and add the vertices to m_surface list.the up, left, front edges only share 4 points, we first get the vectors at these 4 points and exam whether those three edges are intersected by the surface. More...
 
void getProjection (const Eigen::Vector4f &p, pcl::Indices &pt_union_indices, Eigen::Vector4f &projection)
 Given the coordinates of one point, project it onto the surface, return the projected point. More...
 
void getProjectionWithPlaneFit (const Eigen::Vector4f &p, pcl::Indices &pt_union_indices, Eigen::Vector4f &projection)
 Given the coordinates of one point, project it onto the surface, return the projected point. More...
 
void getVectorAtPoint (const Eigen::Vector4f &p, pcl::Indices &pt_union_indices, Eigen::Vector3f &vo)
 Given the location of a point, get it's vector. More...
 
void getVectorAtPointKNN (const Eigen::Vector4f &p, pcl::Indices &k_indices, std::vector< float > &k_squared_distances, Eigen::Vector3f &vo)
 Given the location of a point, get it's vector. More...
 
double getMagAtPoint (const Eigen::Vector4f &p, const pcl::Indices &pt_union_indices)
 Get the magnitude of the vector by summing up the distance. More...
 
double getD1AtPoint (const Eigen::Vector4f &p, const Eigen::Vector3f &vec, const pcl::Indices &pt_union_indices)
 Get the 1st derivative. More...
 
double getD2AtPoint (const Eigen::Vector4f &p, const Eigen::Vector3f &vec, const pcl::Indices &pt_union_indices)
 Get the 2nd derivative. More...
 
bool isIntersected (const std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > &end_pts, std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > &vect_at_end_pts, pcl::Indices &pt_union_indices)
 Test whether the edge is intersected by the surface by doing the dot product of the vector at two end points. More...
 
void findIntersection (int level, const std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > &end_pts, const std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > &vect_at_end_pts, const Eigen::Vector4f &start_pt, pcl::Indices &pt_union_indices, Eigen::Vector4f &intersection)
 Find point where the edge intersects the surface. More...
 
void storeVectAndSurfacePoint (int index_1d, const Eigen::Vector3i &index_3d, pcl::Indices &pt_union_indices, const Leaf &cell_data)
 Go through all the entries in the hash table and update the cellData. More...
 
void storeVectAndSurfacePointKNN (int index_1d, const Eigen::Vector3i &index_3d, const Leaf &cell_data)
 Go through all the entries in the hash table and update the cellData. More...
 
- Protected Member Functions inherited from pcl::PCLBase< PointInT >
bool initCompute ()
 This method should get called before starting the actual computation. More...
 
bool deinitCompute ()
 This method should get called after finishing the actual computation. More...
 

Additional Inherited Members

- Protected Attributes inherited from pcl::SurfaceReconstruction< PointNT >
bool check_tree_
 A flag specifying whether or not the derived reconstruction algorithm needs the search object tree. More...
 
- Protected Attributes inherited from pcl::PCLSurfaceBase< PointInT >
KdTreePtr tree_
 A pointer to the spatial search object. More...
 
- Protected Attributes inherited from pcl::PCLBase< PointInT >
PointCloudConstPtr input_
 The input point cloud dataset. More...
 
IndicesPtr indices_
 A pointer to the vector of point indices to use. More...
 
bool use_indices_
 Set to true if point indices are used. More...
 
bool fake_indices_
 If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud. More...
 

Detailed Description

template<typename PointNT>
class pcl::GridProjection< PointNT >

Grid projection surface reconstruction method.

Author
Rosie Li
Note
If you use this code in any academic work, please cite:
  • Ruosi Li, Lu Liu, Ly Phan, Sasakthi Abeysinghe, Cindy Grimm, Tao Ju. Polygonizing extremal surfaces with manifold guarantees. In Proceedings of the 14th ACM Symposium on Solid and Physical Modeling, 2010.

Definition at line 75 of file grid_projection.h.

Member Typedef Documentation

◆ ConstPtr

template<typename PointNT >
using pcl::GridProjection< PointNT >::ConstPtr = shared_ptr<const GridProjection<PointNT> >

Definition at line 79 of file grid_projection.h.

◆ HashMap

template<typename PointNT >
using pcl::GridProjection< PointNT >::HashMap = std::unordered_map<int, Leaf, std::hash<int>, std::equal_to<>, Eigen::aligned_allocator<std::pair<const int, Leaf> >>

Definition at line 99 of file grid_projection.h.

◆ KdTree

template<typename PointNT >
using pcl::GridProjection< PointNT >::KdTree = pcl::KdTree<PointNT>

Definition at line 86 of file grid_projection.h.

◆ KdTreePtr

template<typename PointNT >
using pcl::GridProjection< PointNT >::KdTreePtr = typename KdTree::Ptr

Definition at line 87 of file grid_projection.h.

◆ PointCloudPtr

template<typename PointNT >
using pcl::GridProjection< PointNT >::PointCloudPtr = typename pcl::PointCloud<PointNT>::Ptr

Definition at line 84 of file grid_projection.h.

◆ Ptr

template<typename PointNT >
using pcl::GridProjection< PointNT >::Ptr = shared_ptr<GridProjection<PointNT> >

Definition at line 78 of file grid_projection.h.

Constructor & Destructor Documentation

◆ GridProjection() [1/2]

template<typename PointNT >
pcl::GridProjection< PointNT >::GridProjection

Constructor.

Definition at line 49 of file grid_projection.hpp.

◆ GridProjection() [2/2]

template<typename PointNT >
pcl::GridProjection< PointNT >::GridProjection ( double  in_resolution)

Constructor.

Parameters
in_resolutionset the resolution of the grid

Definition at line 56 of file grid_projection.hpp.

◆ ~GridProjection()

template<typename PointNT >
pcl::GridProjection< PointNT >::~GridProjection
override

Destructor.

Definition at line 63 of file grid_projection.hpp.

Member Function Documentation

◆ createSurfaceForCell()

template<typename PointNT >
void pcl::GridProjection< PointNT >::createSurfaceForCell ( const Eigen::Vector3i &  index,
pcl::Indices pt_union_indices 
)
protected

Given the index of a cell, exam it's up, left, front edges, and add the vertices to m_surface list.the up, left, front edges only share 4 points, we first get the vectors at these 4 points and exam whether those three edges are intersected by the surface.

Parameters
indexthe input index
pt_union_indicesthe union of input data points within the cell and padding cells

Definition at line 174 of file grid_projection.hpp.

References pcl::I_SHIFT_EDGE, and pcl::I_SHIFT_PT.

◆ fillPad()

template<typename PointNT >
void pcl::GridProjection< PointNT >::fillPad ( const Eigen::Vector3i &  index)
protected

For a given 3d index of a cell, test whether the cells within its padding area exist in the hash table, if no, create an entry for that cell.

Parameters
indexthe index of the cell in (x,y,z) format

Definition at line 555 of file grid_projection.hpp.

◆ findIntersection()

template<typename PointNT >
void pcl::GridProjection< PointNT >::findIntersection ( int  level,
const std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > &  end_pts,
const std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > &  vect_at_end_pts,
const Eigen::Vector4f &  start_pt,
pcl::Indices pt_union_indices,
Eigen::Vector4f &  intersection 
)
protected

Find point where the edge intersects the surface.

Parameters
levelbinary search level
end_ptsthe two end points on the edge
vect_at_end_ptsthe vectors at the two end points
start_ptthe starting point we use for binary search
pt_union_indicesthe union of input data points within the cell and padding cells
intersectionthe resultant intersection point

Definition at line 507 of file grid_projection.hpp.

◆ getBoundingBox()

template<typename PointNT >
void pcl::GridProjection< PointNT >::getBoundingBox
protected

Get the bounding box for the input data points, also calculating the cell size, and the gaussian scale factor.

Definition at line 87 of file grid_projection.hpp.

References pcl::getMinMax3D().

◆ getCellCenterFromIndex()

template<typename PointNT >
void pcl::GridProjection< PointNT >::getCellCenterFromIndex ( const Eigen::Vector3i &  index,
Eigen::Vector4f &  center 
) const
inlineprotected

Given the 3d index (x, y, z) of the cell, get the coordinates of the cell center.

Parameters
indexthe output 3d index
centerthe resultant cell center

Definition at line 261 of file grid_projection.h.

◆ getCellHashMap()

template<typename PointNT >
const HashMap& pcl::GridProjection< PointNT >::getCellHashMap ( ) const
inline

Definition at line 179 of file grid_projection.h.

◆ getCellIndex()

template<typename PointNT >
void pcl::GridProjection< PointNT >::getCellIndex ( const Eigen::Vector4f &  p,
Eigen::Vector3i &  index 
) const
inlineprotected

Get the 3d index (x,y,z) of the cell based on the location of the cell.

Parameters
pthe coordinate of the input point
indexthe output 3d index

Definition at line 249 of file grid_projection.h.

◆ getD1AtPoint()

template<typename PointNT >
double pcl::GridProjection< PointNT >::getD1AtPoint ( const Eigen::Vector4f &  p,
const Eigen::Vector3f &  vec,
const pcl::Indices pt_union_indices 
)
protected

Get the 1st derivative.

Parameters
pthe coordinate of the input point
vecthe vector at point p
pt_union_indicesthe union of input data points within the cell and padding cells

Definition at line 446 of file grid_projection.hpp.

◆ getD2AtPoint()

template<typename PointNT >
double pcl::GridProjection< PointNT >::getD2AtPoint ( const Eigen::Vector4f &  p,
const Eigen::Vector3f &  vec,
const pcl::Indices pt_union_indices 
)
protected

Get the 2nd derivative.

Parameters
pthe coordinate of the input point
vecthe vector at point p
pt_union_indicesthe union of input data points within the cell and padding cells

Definition at line 459 of file grid_projection.hpp.

◆ getDataPtsUnion()

template<typename PointNT >
void pcl::GridProjection< PointNT >::getDataPtsUnion ( const Eigen::Vector3i &  index,
pcl::Indices pt_union_indices 
)
protected

Obtain the index of a cell and the pad size.

Parameters
indexthe input index
pt_union_indicesthe union of input data points within the cell and padding cells

Definition at line 148 of file grid_projection.hpp.

◆ getIndexIn1D()

template<typename PointNT >
int pcl::GridProjection< PointNT >::getIndexIn1D ( const Eigen::Vector3i &  index) const
inlineprotected

Given an index (x, y, z) in 3d, translate it into the index in 1d.

Parameters
indexthe index of the cell in (x,y,z) 3d format

Definition at line 283 of file grid_projection.h.

◆ getIndexIn3D()

template<typename PointNT >
void pcl::GridProjection< PointNT >::getIndexIn3D ( int  index_1d,
Eigen::Vector3i &  index_3d 
) const
inlineprotected

Given an index in 1d, translate it into the index (x, y, z) in 3d.

Parameters
index_1dthe input 1d index
index_3dthe output 3d index

Definition at line 296 of file grid_projection.h.

◆ getMagAtPoint()

template<typename PointNT >
double pcl::GridProjection< PointNT >::getMagAtPoint ( const Eigen::Vector4f &  p,
const pcl::Indices pt_union_indices 
)
protected

Get the magnitude of the vector by summing up the distance.

Parameters
pthe coordinate of the input point
pt_union_indicesthe union of input data points within the cell and padding cells

Definition at line 430 of file grid_projection.hpp.

References M_E.

◆ getMaxBinarySearchLevel()

template<typename PointNT >
int pcl::GridProjection< PointNT >::getMaxBinarySearchLevel ( ) const
inline

Definition at line 172 of file grid_projection.h.

◆ getNearestNeighborNum()

template<typename PointNT >
int pcl::GridProjection< PointNT >::getNearestNeighborNum ( ) const
inline

Definition at line 157 of file grid_projection.h.

◆ getPaddingSize()

template<typename PointNT >
int pcl::GridProjection< PointNT >::getPaddingSize ( ) const
inline

Definition at line 142 of file grid_projection.h.

◆ getProjection()

template<typename PointNT >
void pcl::GridProjection< PointNT >::getProjection ( const Eigen::Vector4f &  p,
pcl::Indices pt_union_indices,
Eigen::Vector4f &  projection 
)
protected

Given the coordinates of one point, project it onto the surface, return the projected point.

Do a binary search between p and p+projection_distance to find the projected point

Parameters
pthe coordinates of the input point
pt_union_indicesthe union of input data points within the cell and padding cells
projectionthe resultant point projected

Definition at line 273 of file grid_projection.hpp.

◆ getProjectionWithPlaneFit()

template<typename PointNT >
void pcl::GridProjection< PointNT >::getProjectionWithPlaneFit ( const Eigen::Vector4f &  p,
pcl::Indices pt_union_indices,
Eigen::Vector4f &  projection 
)
protected

Given the coordinates of one point, project it onto the surface, return the projected point.

Find the plane which fits all the points in pt_union_indices, projected p to the plane to get the projected point.

Parameters
pthe coordinates of the input point
pt_union_indicesthe union of input data points within the cell and padding cells
projectionthe resultant point projected
Remarks
iterative weighted least squares or sac might give better results

Definition at line 312 of file grid_projection.hpp.

References pcl::computeMeanAndCovarianceMatrix(), pcl::geometry::distance(), and pcl::eigen33().

◆ getResolution()

template<typename PointNT >
double pcl::GridProjection< PointNT >::getResolution ( ) const
inline

Definition at line 122 of file grid_projection.h.

◆ getSurface()

template<typename PointNT >
const std::vector<Eigen::Vector4f, Eigen::aligned_allocator<Eigen::Vector4f> >& pcl::GridProjection< PointNT >::getSurface ( ) const
inline

Definition at line 191 of file grid_projection.h.

◆ getVectorAtDataPoint()

template<typename PointNT >
const std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> >& pcl::GridProjection< PointNT >::getVectorAtDataPoint ( ) const
inline

Definition at line 185 of file grid_projection.h.

◆ getVectorAtPoint()

template<typename PointNT >
void pcl::GridProjection< PointNT >::getVectorAtPoint ( const Eigen::Vector4f &  p,
pcl::Indices pt_union_indices,
Eigen::Vector3f &  vo 
)
protected

Given the location of a point, get it's vector.

Parameters
pthe coordinates of the input point
pt_union_indicesthe union of input data points within the cell and padding cells
vothe resultant vector

Definition at line 351 of file grid_projection.hpp.

References pcl::VectorAverage< real, dimension >::add(), pcl::VectorAverage< real, dimension >::getMean(), and M_E.

◆ getVectorAtPointKNN()

template<typename PointNT >
void pcl::GridProjection< PointNT >::getVectorAtPointKNN ( const Eigen::Vector4f &  p,
pcl::Indices k_indices,
std::vector< float > &  k_squared_distances,
Eigen::Vector3f &  vo 
)
protected

Given the location of a point, get it's vector.

Parameters
pthe coordinates of the input point
k_indicesthe k nearest neighbors of the query point
k_squared_distancesthe squared distances of the k nearest neighbors to the query point
vothe resultant vector

Definition at line 396 of file grid_projection.hpp.

References pcl::VectorAverage< real, dimension >::add(), pcl::VectorAverage< real, dimension >::getEigenVector1(), and M_E.

◆ getVertexFromCellCenter()

template<typename PointNT >
void pcl::GridProjection< PointNT >::getVertexFromCellCenter ( const Eigen::Vector4f &  cell_center,
std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > &  pts 
) const
protected

Given cell center, caluate the coordinates of the eight vertices of the cell.

Parameters
cell_centerthe coordinates of the cell center
ptsthe coordinates of the 8 vertices

Definition at line 128 of file grid_projection.hpp.

◆ isIntersected()

template<typename PointNT >
bool pcl::GridProjection< PointNT >::isIntersected ( const std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > &  end_pts,
std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > &  vect_at_end_pts,
pcl::Indices pt_union_indices 
)
protected

Test whether the edge is intersected by the surface by doing the dot product of the vector at two end points.

Also test whether the edge is intersected by the maximum surface by examining the 2nd derivative of the intersection point

Parameters
end_ptsthe two points of the edge
vect_at_end_pts
pt_union_indicesthe union of input data points within the cell and padding cells

Definition at line 472 of file grid_projection.hpp.

◆ performReconstruction() [1/2]

template<typename PointNT >
void pcl::GridProjection< PointNT >::performReconstruction ( pcl::PointCloud< PointNT > &  points,
std::vector< pcl::Vertices > &  polygons 
)
overrideprotectedvirtual

Create the surface.

The 1st step is filling the padding, so that all the cells in the padding area are in the hash map. The 2nd step is store the vector, and projected point. The 3rd step is finding all the edges intersects the surface, and creating surface.

Parameters
[out]pointsthe resultant points lying on the surface
[out]polygonsthe resultant polygons, as a set of vertices. The Vertices structure contains an array of point indices.

Implements pcl::SurfaceReconstruction< PointNT >.

Definition at line 745 of file grid_projection.hpp.

References pcl::PointCloud< PointT >::header, pcl::PointCloud< PointT >::height, pcl::PointCloud< PointT >::is_dense, pcl::PointCloud< PointT >::resize(), pcl::PointCloud< PointT >::size(), and pcl::PointCloud< PointT >::width.

◆ performReconstruction() [2/2]

template<typename PointNT >
void pcl::GridProjection< PointNT >::performReconstruction ( pcl::PolygonMesh output)
overrideprotectedvirtual

Create the surface.

The 1st step is filling the padding, so that all the cells in the padding area are in the hash map. The 2nd step is store the vector, and projected point. The 3rd step is finding all the edges intersects the surface, and creating surface.

Parameters
[out]outputthe resultant polygonal mesh

Implements pcl::SurfaceReconstruction< PointNT >.

Definition at line 719 of file grid_projection.hpp.

References pcl::PolygonMesh::cloud, pcl::PolygonMesh::header, pcl::PointCloud< PointT >::height, pcl::PointCloud< PointT >::is_dense, pcl::PolygonMesh::polygons, pcl::PointCloud< PointT >::resize(), pcl::PointCloud< PointT >::size(), pcl::toPCLPointCloud2(), and pcl::PointCloud< PointT >::width.

◆ reconstructPolygons()

template<typename PointNT >
bool pcl::GridProjection< PointNT >::reconstructPolygons ( std::vector< pcl::Vertices > &  polygons)
protected

The actual surface reconstruction method.

Parameters
[out]polygonsthe resultant polygons, as a set of vertices. The Vertices structure contains an array of point indices.

Definition at line 619 of file grid_projection.hpp.

References pcl::GridProjection< PointNT >::Leaf::data_indices, pcl::isXYZFinite(), pcl::GridProjection< PointNT >::Leaf::pt_on_surface, and pcl::Vertices::vertices.

◆ scaleInputDataPoint()

template<typename PointNT >
void pcl::GridProjection< PointNT >::scaleInputDataPoint ( double  scale_factor)
protected

When the input data points don't fill into the 1*1*1 box, scale them so that they can be filled in the unit box.

Otherwise, it will be some drawing problem when doing visualization

Parameters
scale_factorscale all the input data point by scale_factor

Definition at line 74 of file grid_projection.hpp.

◆ setMaxBinarySearchLevel()

template<typename PointNT >
void pcl::GridProjection< PointNT >::setMaxBinarySearchLevel ( int  max_binary_search_level)
inline

Binary search is used in projection.

given a point x, we find another point which is 3*cell_size_ far away from x. Then we do a binary search between these two points to find where the projected point should be.

Definition at line 167 of file grid_projection.h.

◆ setNearestNeighborNum()

template<typename PointNT >
void pcl::GridProjection< PointNT >::setNearestNeighborNum ( int  k)
inline

Set this only when using the k nearest neighbors search instead of finding the point union.

Parameters
kThe number of nearest neighbors we are looking for

Definition at line 152 of file grid_projection.h.

◆ setPaddingSize()

template<typename PointNT >
void pcl::GridProjection< PointNT >::setPaddingSize ( int  padding_size)
inline

When averaging the vectors, we find the union of all the input data points within the padding area,and do a weighted average.

Say if the padding size is 1, when we process cell (x,y,z), we will find union of input data points from (x-1) to (x+1), (y-1) to (y+1), (z-1) to (z+1)(in total, 27 cells). In this way, even the cells itself doesn't contain any data points, we will still process it because there are data points in the padding area. This can help us fix holes which is smaller than the padding size.

Parameters
padding_sizeThe num of padding cells we want to create

Definition at line 137 of file grid_projection.h.

◆ setResolution()

template<typename PointNT >
void pcl::GridProjection< PointNT >::setResolution ( double  resolution)
inline

Set the size of the grid cell.

Parameters
resolutionthe size of the grid cell

Definition at line 116 of file grid_projection.h.

◆ storeVectAndSurfacePoint()

template<typename PointNT >
void pcl::GridProjection< PointNT >::storeVectAndSurfacePoint ( int  index_1d,
const Eigen::Vector3i &  index_3d,
pcl::Indices pt_union_indices,
const Leaf cell_data 
)
protected

Go through all the entries in the hash table and update the cellData.

When creating the hash table, the pt_on_surface field store the center point of the cell.After calling this function, the projection operator will project the center point onto the surface, and the pt_on_surface field will be updated using the projected point.Also the vect_at_grid_pt field will be updated using the vector at the upper left front vertex of the cell.

Parameters
index_1dthe index of the cell after flatting it's 3d index into a 1d array
index_3dthe index of the cell in (x,y,z) 3d format
pt_union_indicesthe union of input data points within the cell and pads
cell_datainformation stored in the cell

Definition at line 578 of file grid_projection.hpp.

References pcl::GridProjection< PointNT >::Leaf::pt_on_surface.

◆ storeVectAndSurfacePointKNN()

template<typename PointNT >
void pcl::GridProjection< PointNT >::storeVectAndSurfacePointKNN ( int  index_1d,
const Eigen::Vector3i &  index_3d,
const Leaf cell_data 
)
protected

Go through all the entries in the hash table and update the cellData.

When creating the hash table, the pt_on_surface field store the center point of the cell.After calling this function, the projection operator will project the center point onto the surface, and the pt_on_surface field will be updated using the projected point.Also the vect_at_grid_pt field will be updated using the vector at the upper left front vertex of the cell. When projecting the point and calculating the vector, using K nearest neighbors instead of using the union of input data point within the cell and pads.

Parameters
index_1dthe index of the cell after flatting it's 3d index into a 1d array
index_3dthe index of the cell in (x,y,z) 3d format
cell_datainformation stored in the cell

Definition at line 596 of file grid_projection.hpp.

References pcl::GridProjection< PointNT >::Leaf::pt_on_surface.


The documentation for this class was generated from the following files: