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
normal_space.h
Go to the documentation of this file.
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2009-2011, 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
*/
37
38
#ifndef PCL_FILTERS_NORMAL_SUBSAMPLE_H_
39
#define PCL_FILTERS_NORMAL_SUBSAMPLE_H_
40
41
#include <
pcl/filters/filter_indices.h
>
42
#include <time.h>
43
#include <limits.h>
44
45
#include <boost/dynamic_bitset.hpp>
46
47
namespace
pcl
48
{
52
template
<
typename
Po
int
T,
typename
NormalT>
53
class
NormalSpaceSampling
:
public
FilterIndices
<PointT>
54
{
55
using
FilterIndices<PointT>::filter_name_
;
56
using
FilterIndices<PointT>::getClassName
;
57
using
FilterIndices<PointT>::indices_
;
58
using
FilterIndices<PointT>::input_
;
59
60
typedef
typename
FilterIndices<PointT>::PointCloud
PointCloud
;
61
typedef
typename
PointCloud::Ptr
PointCloudPtr
;
62
typedef
typename
PointCloud::ConstPtr
PointCloudConstPtr
;
63
typedef
typename
pcl::PointCloud<NormalT>::Ptr
NormalsPtr;
64
65
public
:
67
NormalSpaceSampling
() :
68
sample_ (UINT_MAX), seed_ (static_cast<unsigned int> (time (NULL))), binsx_ (), binsy_ (), binsz_ (), input_normals_ ()
69
{
70
filter_name_ =
"NormalSpaceSampling"
;
71
}
72
76
inline
void
77
setSample
(
unsigned
int
sample)
78
{
79
sample_ = sample;
80
}
81
83
inline
unsigned
int
84
getSample
()
const
85
{
86
return
(sample_);
87
}
88
92
inline
void
93
setSeed
(
unsigned
int
seed)
94
{
95
seed_ = seed;
96
}
97
99
inline
unsigned
int
100
getSeed
()
const
101
{
102
return
(seed_);
103
}
104
110
inline
void
111
setBins
(
unsigned
int
binsx,
unsigned
int
binsy,
unsigned
int
binsz)
112
{
113
binsx_ = binsx;
114
binsy_ = binsy;
115
binsz_ = binsz;
116
}
117
123
inline
void
124
getBins
(
unsigned
int
& binsx,
unsigned
int
& binsy,
unsigned
int
& binsz)
const
125
{
126
binsx = binsx_;
127
binsy = binsy_;
128
binsz = binsz_;
129
}
130
134
inline
void
135
setNormals
(
const
NormalsPtr &normals) { input_normals_ = normals; }
136
138
inline
NormalsPtr
139
getNormals
()
const
{
return
(input_normals_); }
140
141
protected
:
143
unsigned
int
sample_;
145
unsigned
int
seed_;
146
148
unsigned
int
binsx_;
150
unsigned
int
binsy_;
152
unsigned
int
binsz_;
153
155
NormalsPtr input_normals_;
156
160
void
161
applyFilter (
PointCloud
&output);
162
166
void
167
applyFilter (std::vector<int> &indices);
168
169
private
:
174
unsigned
int
175
findBin (
float
*normal,
unsigned
int
nbins);
176
182
bool
183
isEntireBinSampled (boost::dynamic_bitset<> &array,
unsigned
int
start_index,
unsigned
int
length);
184
185
};
186
}
187
#endif //#ifndef PCL_FILTERS_NORMAL_SPACE_SUBSAMPLE_H_
Generated on Sat Aug 24 2013 17:28:31 for Point Cloud Library (PCL) by
1.8.4