Point Cloud Library (PCL)
1.12.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
surface
reconstruction.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2010-2012, Willow Garage, Inc.
6
*
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of Willow Garage, Inc. nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*
36
* $Id$
37
*
38
*/
39
40
#pragma once
41
42
#include <pcl/pcl_base.h>
43
#include <pcl/PolygonMesh.h>
44
#include <pcl/search/search.h>
// for Search
45
46
namespace
pcl
47
{
48
/** \brief Pure abstract class. All types of meshing/reconstruction
49
* algorithms in \b libpcl_surface must inherit from this, in order to make
50
* sure we have a consistent API. The methods that we care about here are:
51
*
52
* - \b setSearchMethod(&SearchPtr): passes a search locator
53
* - \b reconstruct(&PolygonMesh): creates a PolygonMesh object from the input data
54
*
55
* \author Radu B. Rusu, Michael Dixon, Alexandru E. Ichim
56
* \ingroup surface
57
*/
58
template
<
typename
Po
int
InT>
59
class
PCLSurfaceBase
:
public
PCLBase
<PointInT>
60
{
61
public
:
62
using
Ptr
= shared_ptr<PCLSurfaceBase<PointInT> >;
63
using
ConstPtr
= shared_ptr<const PCLSurfaceBase<PointInT> >;
64
65
using
KdTree
=
pcl::search::Search<PointInT>
;
66
using
KdTreePtr
=
typename
KdTree::Ptr
;
67
68
/** \brief Empty constructor. */
69
PCLSurfaceBase
() :
tree_
() {}
70
71
/** \brief Empty destructor */
72
~PCLSurfaceBase
() {}
73
74
/** \brief Provide an optional pointer to a search object.
75
* \param[in] tree a pointer to the spatial search object.
76
*/
77
inline
void
78
setSearchMethod
(
const
KdTreePtr
&tree)
79
{
80
tree_
= tree;
81
}
82
83
/** \brief Get a pointer to the search method used. */
84
inline
KdTreePtr
85
getSearchMethod
() {
return
(
tree_
); }
86
87
/** \brief Base method for surface reconstruction for all points given in
88
* <setInputCloud (), setIndices ()>
89
* \param[out] output the resultant reconstructed surface model
90
*/
91
virtual
void
92
reconstruct
(
pcl::PolygonMesh
&output) = 0;
93
94
protected
:
95
/** \brief A pointer to the spatial search object. */
96
KdTreePtr
tree_
;
97
98
/** \brief Abstract class get name method. */
99
virtual
std::string
100
getClassName
()
const
{
return
(
""
); }
101
};
102
103
/** \brief SurfaceReconstruction represents a base surface reconstruction
104
* class. All \b surface reconstruction methods take in a point cloud and
105
* generate a new surface from it, by either re-sampling the data or
106
* generating new data altogether. These methods are thus \b not preserving
107
* the topology of the original data.
108
*
109
* \note Reconstruction methods that always preserve the original input
110
* point cloud data as the surface vertices and simply construct the mesh on
111
* top should inherit from \ref MeshConstruction.
112
*
113
* \author Radu B. Rusu, Michael Dixon, Alexandru E. Ichim
114
* \ingroup surface
115
*/
116
template
<
typename
Po
int
InT>
117
class
SurfaceReconstruction
:
public
PCLSurfaceBase
<PointInT>
118
{
119
public
:
120
using
Ptr
= shared_ptr<SurfaceReconstruction<PointInT> >;
121
using
ConstPtr
= shared_ptr<const SurfaceReconstruction<PointInT> >;
122
123
using
PCLSurfaceBase
<PointInT>
::input_
;
124
using
PCLSurfaceBase
<PointInT>
::indices_
;
125
using
PCLSurfaceBase
<PointInT>
::initCompute
;
126
using
PCLSurfaceBase
<PointInT>
::deinitCompute
;
127
using
PCLSurfaceBase
<PointInT>
::tree_
;
128
using
PCLSurfaceBase
<PointInT>
::getClassName
;
129
130
/** \brief Constructor. */
131
SurfaceReconstruction
() :
check_tree_
(true) {}
132
133
/** \brief Destructor. */
134
~SurfaceReconstruction
() {}
135
136
/** \brief Base method for surface reconstruction for all points given in
137
* <setInputCloud (), setIndices ()>
138
* \param[out] output the resultant reconstructed surface model
139
*/
140
void
141
reconstruct
(
pcl::PolygonMesh
&output)
override
;
142
143
/** \brief Base method for surface reconstruction for all points given in
144
* <setInputCloud (), setIndices ()>
145
* \param[out] points the resultant points lying on the new surface
146
* \param[out] polygons the resultant polygons, as a set of
147
* vertices. The Vertices structure contains an array of point indices.
148
*/
149
virtual
void
150
reconstruct
(
pcl::PointCloud<PointInT>
&points,
151
std::vector<pcl::Vertices> &polygons);
152
153
protected
:
154
/** \brief A flag specifying whether or not the derived reconstruction
155
* algorithm needs the search object \a tree.*/
156
bool
check_tree_
;
157
158
/** \brief Abstract surface reconstruction method.
159
* \param[out] output the output polygonal mesh
160
*/
161
virtual
void
162
performReconstruction
(
pcl::PolygonMesh
&output) = 0;
163
164
/** \brief Abstract surface reconstruction method.
165
* \param[out] points the resultant points lying on the surface
166
* \param[out] polygons the resultant polygons, as a set of vertices. The Vertices structure contains an array of point indices.
167
*/
168
virtual
void
169
performReconstruction
(
pcl::PointCloud<PointInT>
&points,
170
std::vector<pcl::Vertices> &polygons) = 0;
171
};
172
173
/** \brief MeshConstruction represents a base surface reconstruction
174
* class. All \b mesh constructing methods that take in a point cloud and
175
* generate a surface that uses the original data as vertices should inherit
176
* from this class.
177
*
178
* \note Reconstruction methods that generate a new surface or create new
179
* vertices in locations different than the input data should inherit from
180
* \ref SurfaceReconstruction.
181
*
182
* \author Radu B. Rusu, Michael Dixon, Alexandru E. Ichim
183
* \ingroup surface
184
*/
185
template
<
typename
Po
int
InT>
186
class
MeshConstruction
:
public
PCLSurfaceBase
<PointInT>
187
{
188
public
:
189
using
Ptr
= shared_ptr<MeshConstruction<PointInT> >;
190
using
ConstPtr
= shared_ptr<const MeshConstruction<PointInT> >;
191
192
using
PCLSurfaceBase
<PointInT>
::input_
;
193
using
PCLSurfaceBase
<PointInT>
::indices_
;
194
using
PCLSurfaceBase
<PointInT>
::initCompute
;
195
using
PCLSurfaceBase
<PointInT>
::deinitCompute
;
196
using
PCLSurfaceBase
<PointInT>
::tree_
;
197
using
PCLSurfaceBase
<PointInT>
::getClassName
;
198
199
/** \brief Constructor. */
200
MeshConstruction
() :
check_tree_
(true) {}
201
202
/** \brief Destructor. */
203
~MeshConstruction
() {}
204
205
/** \brief Base method for surface reconstruction for all points given in
206
* <setInputCloud (), setIndices ()>
207
* \param[out] output the resultant reconstructed surface model
208
*
209
* \note This method copies the input point cloud data from
210
* PointCloud<T> to PCLPointCloud2, and is implemented here for backwards
211
* compatibility only!
212
*
213
*/
214
void
215
reconstruct
(
pcl::PolygonMesh
&output)
override
;
216
217
/** \brief Base method for mesh construction for all points given in
218
* <setInputCloud (), setIndices ()>
219
* \param[out] polygons the resultant polygons, as a set of
220
* vertices. The Vertices structure contains an array of point indices.
221
*/
222
virtual
void
223
reconstruct
(std::vector<pcl::Vertices> &polygons);
224
225
protected
:
226
/** \brief A flag specifying whether or not the derived reconstruction
227
* algorithm needs the search object \a tree.*/
228
bool
check_tree_
;
229
230
/** \brief Abstract surface reconstruction method.
231
* \param[out] output the output polygonal mesh
232
*/
233
virtual
void
234
performReconstruction
(
pcl::PolygonMesh
&output) = 0;
235
236
/** \brief Abstract surface reconstruction method.
237
* \param[out] polygons the resultant polygons, as a set of vertices. The Vertices structure contains an array of point indices.
238
*/
239
virtual
void
240
performReconstruction
(std::vector<pcl::Vertices> &polygons) = 0;
241
};
242
}
243
244
#include <pcl/surface/impl/reconstruction.hpp>
pcl::MeshConstruction::Ptr
shared_ptr< MeshConstruction< PointInT > > Ptr
Definition
reconstruction.h:189
pcl::MeshConstruction::ConstPtr
shared_ptr< const MeshConstruction< PointInT > > ConstPtr
Definition
reconstruction.h:190
pcl::MeshConstruction::MeshConstruction
MeshConstruction()
Constructor.
Definition
reconstruction.h:200
pcl::MeshConstruction::performReconstruction
virtual void performReconstruction(pcl::PolygonMesh &output)=0
Abstract surface reconstruction method.
pcl::MeshConstruction::reconstruct
void reconstruct(pcl::PolygonMesh &output) override
Base method for surface reconstruction for all points given in <setInputCloud (), setIndices ()>.
Definition
reconstruction.hpp:132
pcl::MeshConstruction::performReconstruction
virtual void performReconstruction(std::vector< pcl::Vertices > &polygons)=0
Abstract surface reconstruction method.
pcl::MeshConstruction::~MeshConstruction
~MeshConstruction()
Destructor.
Definition
reconstruction.h:203
pcl::MeshConstruction::check_tree_
bool check_tree_
A flag specifying whether or not the derived reconstruction algorithm needs the search object tree.
Definition
reconstruction.h:228
pcl::PCLBase< PointInT >::input_
PointCloudConstPtr input_
Definition
pcl_base.h:147
pcl::PCLBase< PointInT >::indices_
IndicesPtr indices_
Definition
pcl_base.h:150
pcl::PCLBase< PointInT >::initCompute
bool initCompute()
pcl::PCLBase< PointInT >::PCLBase
PCLBase()
pcl::PCLBase< PointInT >::deinitCompute
bool deinitCompute()
pcl::PCLSurfaceBase::ConstPtr
shared_ptr< const PCLSurfaceBase< PointInT > > ConstPtr
Definition
reconstruction.h:63
pcl::PCLSurfaceBase::KdTreePtr
typename KdTree::Ptr KdTreePtr
Definition
reconstruction.h:66
pcl::PCLSurfaceBase::getSearchMethod
KdTreePtr getSearchMethod()
Get a pointer to the search method used.
Definition
reconstruction.h:85
pcl::PCLSurfaceBase::tree_
KdTreePtr tree_
A pointer to the spatial search object.
Definition
reconstruction.h:96
pcl::PCLSurfaceBase::getClassName
virtual std::string getClassName() const
Abstract class get name method.
Definition
reconstruction.h:100
pcl::PCLSurfaceBase::Ptr
shared_ptr< PCLSurfaceBase< PointInT > > Ptr
Definition
reconstruction.h:62
pcl::PCLSurfaceBase::PCLSurfaceBase
PCLSurfaceBase()
Empty constructor.
Definition
reconstruction.h:69
pcl::PCLSurfaceBase::KdTree
pcl::search::Search< PointInT > KdTree
Definition
reconstruction.h:65
pcl::PCLSurfaceBase::~PCLSurfaceBase
~PCLSurfaceBase()
Empty destructor.
Definition
reconstruction.h:72
pcl::PCLSurfaceBase::reconstruct
virtual void reconstruct(pcl::PolygonMesh &output)=0
Base method for surface reconstruction for all points given in <setInputCloud (), setIndices ()>.
pcl::PCLSurfaceBase::setSearchMethod
void setSearchMethod(const KdTreePtr &tree)
Provide an optional pointer to a search object.
Definition
reconstruction.h:78
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition
point_cloud.h:173
pcl::SurfaceReconstruction::performReconstruction
virtual void performReconstruction(pcl::PolygonMesh &output)=0
Abstract surface reconstruction method.
pcl::SurfaceReconstruction::check_tree_
bool check_tree_
A flag specifying whether or not the derived reconstruction algorithm needs the search object tree.
Definition
reconstruction.h:156
pcl::SurfaceReconstruction::reconstruct
void reconstruct(pcl::PolygonMesh &output) override
Base method for surface reconstruction for all points given in <setInputCloud (), setIndices ()>.
Definition
reconstruction.hpp:52
pcl::SurfaceReconstruction::~SurfaceReconstruction
~SurfaceReconstruction()
Destructor.
Definition
reconstruction.h:134
pcl::SurfaceReconstruction::SurfaceReconstruction
SurfaceReconstruction()
Constructor.
Definition
reconstruction.h:131
pcl::SurfaceReconstruction::Ptr
shared_ptr< SurfaceReconstruction< PointInT > > Ptr
Definition
reconstruction.h:120
pcl::SurfaceReconstruction::ConstPtr
shared_ptr< const SurfaceReconstruction< PointInT > > ConstPtr
Definition
reconstruction.h:121
pcl::SurfaceReconstruction::performReconstruction
virtual void performReconstruction(pcl::PointCloud< PointInT > &points, std::vector< pcl::Vertices > &polygons)=0
Abstract surface reconstruction method.
pcl::search::Search
Generic search class.
Definition
search.h:75
pcl::search::Search< PointInT >::Ptr
shared_ptr< pcl::search::Search< PointInT > > Ptr
Definition
search.h:81
pcl
Definition
convolution.h:46
pcl::PolygonMesh
Definition
PolygonMesh.h:15