Point Cloud Library (PCL)
1.7.2
Main Page
Modules
Namespaces
Classes
keypoints
include
pcl
keypoints
iss_3d.h
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
*/
35
36
#ifndef PCL_ISS_3D_H_
37
#define PCL_ISS_3D_H_
38
39
#include <pcl/keypoints/keypoint.h>
40
41
namespace
pcl
42
{
43
/** \brief ISSKeypoint3D detects the Intrinsic Shape Signatures keypoints for a given
44
* point cloud. This class is based on a particular implementation made by Federico
45
* Tombari and Samuele Salti and it has been explicitly adapted to PCL.
46
*
47
* For more information about the original ISS detector, see:
48
*
49
*\par
50
* Yu Zhong, “Intrinsic shape signatures: A shape descriptor for 3D object recognition,”
51
* Computer Vision Workshops (ICCV Workshops), 2009 IEEE 12th International Conference on ,
52
* vol., no., pp.689-696, Sept. 27 2009-Oct. 4 2009
53
*
54
* Code example:
55
*
56
* \code
57
* pcl::PointCloud<pcl::PointXYZRGBA>::Ptr model (new pcl::PointCloud<pcl::PointXYZRGBA> ());;
58
* pcl::PointCloud<pcl::PointXYZRGBA>::Ptr model_keypoints (new pcl::PointCloud<pcl::PointXYZRGBA> ());
59
* pcl::search::KdTree<pcl::PointXYZRGBA>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZRGBA> ());
60
*
61
* // Fill in the model cloud
62
*
63
* double model_resolution;
64
*
65
* // Compute model_resolution
66
*
67
* pcl::ISSKeypoint3D<pcl::PointXYZRGBA, pcl::PointXYZRGBA> iss_detector;
68
*
69
* iss_detector.setSearchMethod (tree);
70
* iss_detector.setSalientRadius (6 * model_resolution);
71
* iss_detector.setNonMaxRadius (4 * model_resolution);
72
* iss_detector.setThreshold21 (0.975);
73
* iss_detector.setThreshold32 (0.975);
74
* iss_detector.setMinNeighbors (5);
75
* iss_detector.setNumberOfThreads (4);
76
* iss_detector.setInputCloud (model);
77
* iss_detector.compute (*model_keypoints);
78
* \endcode
79
*
80
* \author Gioia Ballin
81
* \ingroup keypoints
82
*/
83
84
template
<
typename
Po
int
InT,
typename
Po
int
OutT,
typename
NormalT = pcl::Normal>
85
class
ISSKeypoint3D
:
public
Keypoint
<PointInT, PointOutT>
86
{
87
public
:
88
typedef
boost::shared_ptr<ISSKeypoint3D<PointInT, PointOutT, NormalT> >
Ptr
;
89
typedef
boost::shared_ptr<const ISSKeypoint3D<PointInT, PointOutT, NormalT> >
ConstPtr
;
90
91
typedef
typename
Keypoint<PointInT, PointOutT>::PointCloudIn
PointCloudIn
;
92
typedef
typename
Keypoint<PointInT, PointOutT>::PointCloudOut
PointCloudOut
;
93
94
typedef
typename
pcl::PointCloud<NormalT>
PointCloudN
;
95
typedef
typename
PointCloudN::Ptr
PointCloudNPtr
;
96
typedef
typename
PointCloudN::ConstPtr
PointCloudNConstPtr
;
97
98
typedef
typename
pcl::octree::OctreePointCloudSearch<PointInT>
OctreeSearchIn
;
99
typedef
typename
OctreeSearchIn::Ptr
OctreeSearchInPtr
;
100
101
using
Keypoint<PointInT, PointOutT>::name_
;
102
using
Keypoint<PointInT, PointOutT>::input_
;
103
using
Keypoint<PointInT, PointOutT>::surface_
;
104
using
Keypoint<PointInT, PointOutT>::tree_
;
105
using
Keypoint<PointInT, PointOutT>::search_radius_
;
106
using
Keypoint<PointInT, PointOutT>::search_parameter_
;
107
using
Keypoint<PointInT, PointOutT>::keypoints_indices_
;
108
109
/** \brief Constructor.
110
* \param[in] salient_radius the radius of the spherical neighborhood used to compute the scatter matrix.
111
*/
112
ISSKeypoint3D
(
double
salient_radius = 0.0001)
113
:
salient_radius_
(salient_radius)
114
,
non_max_radius_
(0.0)
115
,
normal_radius_
(0.0)
116
,
border_radius_
(0.0)
117
,
gamma_21_
(0.975)
118
,
gamma_32_
(0.975)
119
,
third_eigen_value_
(0)
120
,
edge_points_
(0)
121
,
min_neighbors_
(5)
122
,
normals_
(new pcl::
PointCloud
<
NormalT
>)
123
,
angle_threshold_
(static_cast<float> (M_PI) / 2.0f)
124
,
threads_
(0)
125
{
126
name_
=
"ISSKeypoint3D"
;
127
search_radius_
=
salient_radius_
;
128
}
129
130
/** \brief Set the radius of the spherical neighborhood used to compute the scatter matrix.
131
* \param[in] salient_radius the radius of the spherical neighborhood
132
*/
133
void
134
setSalientRadius
(
double
salient_radius);
135
136
/** \brief Set the radius for the application of the non maxima supression algorithm.
137
* \param[in] non_max_radius the non maxima suppression radius
138
*/
139
void
140
setNonMaxRadius
(
double
non_max_radius);
141
142
/** \brief Set the radius used for the estimation of the surface normals of the input cloud. If the radius is
143
* too large, the temporal performances of the detector may degrade significantly.
144
* \param[in] normal_radius the radius used to estimate surface normals
145
*/
146
void
147
setNormalRadius
(
double
normal_radius);
148
149
/** \brief Set the radius used for the estimation of the boundary points. If the radius is too large,
150
* the temporal performances of the detector may degrade significantly.
151
* \param[in] border_radius the radius used to compute the boundary points
152
*/
153
void
154
setBorderRadius
(
double
border_radius);
155
156
/** \brief Set the upper bound on the ratio between the second and the first eigenvalue.
157
* \param[in] gamma_21 the upper bound on the ratio between the second and the first eigenvalue
158
*/
159
void
160
setThreshold21
(
double
gamma_21);
161
162
/** \brief Set the upper bound on the ratio between the third and the second eigenvalue.
163
* \param[in] gamma_32 the upper bound on the ratio between the third and the second eigenvalue
164
*/
165
void
166
setThreshold32
(
double
gamma_32);
167
168
/** \brief Set the minimum number of neighbors that has to be found while applying the non maxima suppression algorithm.
169
* \param[in] min_neighbors the minimum number of neighbors required
170
*/
171
void
172
setMinNeighbors
(
int
min_neighbors);
173
174
/** \brief Set the normals if pre-calculated normals are available.
175
* \param[in] normals the given cloud of normals
176
*/
177
void
178
setNormals
(
const
PointCloudNConstPtr
&normals);
179
180
/** \brief Set the decision boundary (angle threshold) that marks points as boundary or regular.
181
* (default \f$\pi / 2.0\f$)
182
* \param[in] angle the angle threshold
183
*/
184
inline
void
185
setAngleThreshold
(
float
angle)
186
{
187
angle_threshold_
= angle;
188
}
189
190
/** \brief Initialize the scheduler and set the number of threads to use.
191
* \param[in] nr_threads the number of hardware threads to use (0 sets the value back to automatic)
192
*/
193
inline
void
194
setNumberOfThreads
(
unsigned
int
nr_threads = 0) {
threads_
= nr_threads; }
195
196
protected
:
197
198
/** \brief Compute the boundary points for the given input cloud.
199
* \param[in] input the input cloud
200
* \param[in] border_radius the radius used to compute the boundary points
201
* \param[in] angle_threshold the decision boundary that marks the points as boundary
202
* \return the vector of boolean values in which the information about the boundary points is stored
203
*/
204
bool
*
205
getBoundaryPoints
(
PointCloudIn
&input,
double
border_radius,
float
angle_threshold);
206
207
/** \brief Compute the scatter matrix for a point index.
208
* \param[in] current_index the index of the point
209
* \param[out] cov_m the point scatter matrix
210
*/
211
void
212
getScatterMatrix
(
const
int
¤t_index, Eigen::Matrix3d &cov_m);
213
214
/** \brief Perform the initial checks before computing the keypoints.
215
* \return true if all the checks are passed, false otherwise
216
*/
217
bool
218
initCompute
();
219
220
/** \brief Detect the keypoints by performing the EVD of the scatter matrix.
221
* \param[out] output the resultant cloud of keypoints
222
*/
223
void
224
detectKeypoints
(
PointCloudOut
&output);
225
226
227
/** \brief The radius of the spherical neighborhood used to compute the scatter matrix.*/
228
double
salient_radius_
;
229
230
/** \brief The non maxima suppression radius. */
231
double
non_max_radius_
;
232
233
/** \brief The radius used to compute the normals of the input cloud. */
234
double
normal_radius_
;
235
236
/** \brief The radius used to compute the boundary points of the input cloud. */
237
double
border_radius_
;
238
239
/** \brief The upper bound on the ratio between the second and the first eigenvalue returned by the EVD. */
240
double
gamma_21_
;
241
242
/** \brief The upper bound on the ratio between the third and the second eigenvalue returned by the EVD. */
243
double
gamma_32_
;
244
245
/** \brief Store the third eigen value associated to each point in the input cloud. */
246
double
*
third_eigen_value_
;
247
248
/** \brief Store the information about the boundary points of the input cloud. */
249
bool
*
edge_points_
;
250
251
/** \brief Minimum number of neighbors that has to be found while applying the non maxima suppression algorithm. */
252
int
min_neighbors_
;
253
254
/** \brief The cloud of normals related to the input surface. */
255
PointCloudNConstPtr
normals_
;
256
257
/** \brief The decision boundary (angle threshold) that marks points as boundary or regular. (default \f$\pi / 2.0\f$) */
258
float
angle_threshold_
;
259
260
/** \brief The number of threads that has to be used by the scheduler. */
261
unsigned
int
threads_
;
262
263
};
264
265
}
266
267
#include <pcl/keypoints/impl/iss_3d.hpp>
268
269
#endif
/* PCL_ISS_3D_H_ */