Point Cloud Library (PCL)
1.6.0
Main Page
Modules
Namespaces
Classes
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
filters
include
pcl
filters
project_inliers.h
Go to the documentation of this file.
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Copyright (c) 2010, Willow Garage, Inc.
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
9
* are met:
10
*
11
* * Redistributions of source code must retain the above copyright
12
* notice, this list of conditions and the following disclaimer.
13
* * Redistributions in binary form must reproduce the above
14
* copyright notice, this list of conditions and the following
15
* disclaimer in the documentation and/or other materials provided
16
* with the distribution.
17
* * Neither the name of Willow Garage, Inc. nor the names of its
18
* contributors may be used to endorse or promote products derived
19
* from this software without specific prior written permission.
20
*
21
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
* POSSIBILITY OF SUCH DAMAGE.
33
*
34
* $Id: project_inliers.h 6144 2012-07-04 22:06:28Z rusu $
35
*
36
*/
37
38
#ifndef PCL_FILTERS_PROJECT_INLIERS_H_
39
#define PCL_FILTERS_PROJECT_INLIERS_H_
40
41
#include <
pcl/point_types.h
>
42
#include <
pcl/filters/filter.h
>
43
#include <
pcl/ModelCoefficients.h
>
44
// Sample Consensus models
45
#include <
pcl/sample_consensus/model_types.h
>
46
#include <
pcl/sample_consensus/sac_model.h
>
47
#include <
pcl/sample_consensus/sac_model_circle.h
>
48
#include <
pcl/sample_consensus/sac_model_cylinder.h
>
49
#include <
pcl/sample_consensus/sac_model_cone.h
>
50
#include <
pcl/sample_consensus/sac_model_line.h
>
51
#include <
pcl/sample_consensus/sac_model_normal_plane.h
>
52
#include <
pcl/sample_consensus/sac_model_normal_sphere.h
>
53
#include <
pcl/sample_consensus/sac_model_parallel_plane.h
>
54
#include <
pcl/sample_consensus/sac_model_normal_parallel_plane.h
>
55
#include <
pcl/sample_consensus/sac_model_parallel_line.h
>
56
#include <
pcl/sample_consensus/sac_model_perpendicular_plane.h
>
57
#include <
pcl/sample_consensus/sac_model_plane.h
>
58
#include <
pcl/sample_consensus/sac_model_sphere.h
>
59
60
namespace
pcl
61
{
63
68
template
<
typename
Po
int
T>
69
class
ProjectInliers
:
public
Filter
<PointT>
70
{
71
using
Filter<PointT>::input_
;
72
using
Filter<PointT>::indices_
;
73
using
Filter<PointT>::filter_name_
;
74
using
Filter<PointT>::getClassName
;
75
76
typedef
typename
Filter<PointT>::PointCloud
PointCloud
;
77
typedef
typename
PointCloud::Ptr
PointCloudPtr
;
78
typedef
typename
PointCloud::ConstPtr
PointCloudConstPtr
;
79
80
typedef
typename
SampleConsensusModel<PointT>::Ptr
SampleConsensusModelPtr;
81
public
:
83
ProjectInliers
() : model_ (), sacmodel_ (), model_type_ (), copy_all_data_ (false)
84
{
85
filter_name_ =
"ProjectInliers"
;
86
}
87
91
inline
void
92
setModelType
(
int
model)
93
{
94
model_type_ = model;
95
}
96
98
inline
int
99
getModelType
()
100
{
101
return
(model_type_);
102
}
103
107
inline
void
108
setModelCoefficients
(
const
ModelCoefficientsConstPtr
&model)
109
{
110
model_ = model;
111
}
112
114
inline
ModelCoefficientsConstPtr
115
getModelCoefficients
()
116
{
117
return
(model_);
118
}
119
123
inline
void
124
setCopyAllData
(
bool
val)
125
{
126
copy_all_data_ = val;
127
}
128
130
inline
bool
131
getCopyAllData
()
132
{
133
return
(copy_all_data_);
134
}
135
protected
:
137
140
void
141
applyFilter (
PointCloud
&output);
142
143
private
:
145
ModelCoefficientsConstPtr
model_;
146
148
SampleConsensusModelPtr sacmodel_;
149
151
int
model_type_;
152
154
bool
copy_all_data_;
155
159
virtual
bool
160
initSACModel (
int
model_type);
161
};
162
164
170
template
<>
171
class
PCL_EXPORTS
ProjectInliers
<sensor_msgs::
PointCloud2
> :
public
Filter
<sensor_msgs::PointCloud2>
172
{
173
using
Filter<sensor_msgs::PointCloud2>::filter_name_
;
174
using
Filter<sensor_msgs::PointCloud2>::getClassName
;
175
176
typedef
sensor_msgs::PointCloud2
PointCloud2
;
177
typedef
PointCloud2::Ptr
PointCloud2Ptr
;
178
typedef
PointCloud2::ConstPtr
PointCloud2ConstPtr
;
179
180
typedef
SampleConsensusModel<PointXYZ>::Ptr
SampleConsensusModelPtr;
181
182
public
:
184
ProjectInliers
() : model_type_ (), copy_all_data_ (false), copy_all_fields_ (true), model_ (), sacmodel_ ()
185
{
186
filter_name_ =
"ProjectInliers"
;
187
}
188
192
inline
void
193
setModelType
(
int
model)
194
{
195
model_type_ = model;
196
}
197
199
inline
int
200
getModelType
()
const
201
{
202
return
(model_type_);
203
}
204
208
inline
void
209
setModelCoefficients
(
const
ModelCoefficientsConstPtr
&model)
210
{
211
model_ = model;
212
}
213
215
inline
ModelCoefficientsConstPtr
216
getModelCoefficients
()
const
217
{
218
return
(model_);
219
}
220
224
inline
void
225
setCopyAllFields
(
bool
val)
226
{
227
copy_all_fields_ = val;
228
}
229
231
inline
bool
232
getCopyAllFields
()
const
233
{
234
return
(copy_all_fields_);
235
}
236
240
inline
void
241
setCopyAllData
(
bool
val)
242
{
243
copy_all_data_ = val;
244
}
245
247
inline
bool
248
getCopyAllData
()
const
249
{
250
return
(copy_all_data_);
251
}
252
protected
:
254
int
model_type_;
255
257
bool
copy_all_data_;
258
260
bool
copy_all_fields_;
261
263
ModelCoefficientsConstPtr
model_;
264
265
void
266
applyFilter (PointCloud2 &output);
267
268
private
:
270
SampleConsensusModelPtr sacmodel_;
271
272
virtual
bool
273
initSACModel (
int
model_type);
274
};
275
}
276
277
#endif //#ifndef PCL_FILTERS_PROJECT_INLIERS_H_
Generated on Sat Aug 24 2013 17:28:31 for Point Cloud Library (PCL) by
1.8.4