Point Cloud Library (PCL)
1.7.1
Main Page
Modules
Namespaces
Classes
features
include
pcl
features
rift.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2010-2011, Willow Garage, Inc.
6
* Copyright (c) 2012-, Open Perception, Inc.
7
*
8
* All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions
12
* are met:
13
*
14
* * Redistributions of source code must retain the above copyright
15
* notice, this list of conditions and the following disclaimer.
16
* * Redistributions in binary form must reproduce the above
17
* copyright notice, this list of conditions and the following
18
* disclaimer in the documentation and/or other materials provided
19
* with the distribution.
20
* * Neither the name of the copyright holder(s) nor the names of its
21
* contributors may be used to endorse or promote products derived
22
* from this software without specific prior written permission.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
* POSSIBILITY OF SUCH DAMAGE.
36
*
37
* $Id$
38
*
39
*/
40
41
#ifndef PCL_RIFT_H_
42
#define PCL_RIFT_H_
43
44
#include <pcl/features/feature.h>
45
46
namespace
pcl
47
{
48
/** \brief RIFTEstimation estimates the Rotation Invariant Feature Transform descriptors for a given point cloud
49
* dataset containing points and intensity. For more information about the RIFT descriptor, see:
50
*
51
* Svetlana Lazebnik, Cordelia Schmid, and Jean Ponce.
52
* A sparse texture representation using local affine regions.
53
* In IEEE Transactions on Pattern Analysis and Machine Intelligence, volume 27, pages 1265-1278, August 2005.
54
*
55
* \author Michael Dixon
56
* \ingroup features
57
*/
58
59
template
<
typename
Po
int
InT,
typename
GradientT,
typename
Po
int
OutT>
60
class
RIFTEstimation
:
public
Feature
<PointInT, PointOutT>
61
{
62
public
:
63
using
Feature<PointInT, PointOutT>::feature_name_
;
64
using
Feature<PointInT, PointOutT>::getClassName
;
65
66
using
Feature<PointInT, PointOutT>::surface_
;
67
using
Feature<PointInT, PointOutT>::indices_
;
68
69
using
Feature<PointInT, PointOutT>::tree_
;
70
using
Feature<PointInT, PointOutT>::search_radius_
;
71
72
typedef
typename
pcl::PointCloud<PointInT>
PointCloudIn
;
73
typedef
typename
Feature<PointInT, PointOutT>::PointCloudOut
PointCloudOut
;
74
75
typedef
typename
pcl::PointCloud<GradientT>
PointCloudGradient
;
76
typedef
typename
PointCloudGradient::Ptr
PointCloudGradientPtr
;
77
typedef
typename
PointCloudGradient::ConstPtr
PointCloudGradientConstPtr
;
78
79
typedef
typename
boost::shared_ptr<RIFTEstimation<PointInT, GradientT, PointOutT> >
Ptr
;
80
typedef
typename
boost::shared_ptr<const RIFTEstimation<PointInT, GradientT, PointOutT> >
ConstPtr
;
81
82
83
/** \brief Empty constructor. */
84
RIFTEstimation
() :
gradient_
(),
nr_distance_bins_
(4),
nr_gradient_bins_
(8)
85
{
86
feature_name_
=
"RIFTEstimation"
;
87
};
88
89
/** \brief Provide a pointer to the input gradient data
90
* \param[in] gradient a pointer to the input gradient data
91
*/
92
inline
void
93
setInputGradient
(
const
PointCloudGradientConstPtr
&gradient) {
gradient_
= gradient; };
94
95
/** \brief Returns a shared pointer to the input gradient data */
96
inline
PointCloudGradientConstPtr
97
getInputGradient
()
const
{
return
(
gradient_
); };
98
99
/** \brief Set the number of bins to use in the distance dimension of the RIFT descriptor
100
* \param[in] nr_distance_bins the number of bins to use in the distance dimension of the RIFT descriptor
101
*/
102
inline
void
103
setNrDistanceBins
(
int
nr_distance_bins) {
nr_distance_bins_
= nr_distance_bins; };
104
105
/** \brief Returns the number of bins in the distance dimension of the RIFT descriptor. */
106
inline
int
107
getNrDistanceBins
()
const
{
return
(
nr_distance_bins_
); };
108
109
/** \brief Set the number of bins to use in the gradient orientation dimension of the RIFT descriptor
110
* \param[in] nr_gradient_bins the number of bins to use in the gradient orientation dimension of the RIFT descriptor
111
*/
112
inline
void
113
setNrGradientBins
(
int
nr_gradient_bins) {
nr_gradient_bins_
= nr_gradient_bins; };
114
115
/** \brief Returns the number of bins in the gradient orientation dimension of the RIFT descriptor. */
116
inline
int
117
getNrGradientBins
()
const
{
return
(
nr_gradient_bins_
); };
118
119
/** \brief Estimate the Rotation Invariant Feature Transform (RIFT) descriptor for a given point based on its
120
* spatial neighborhood of 3D points and the corresponding intensity gradient vector field
121
* \param[in] cloud the dataset containing the Cartesian coordinates of the points
122
* \param[in] gradient the dataset containing the intensity gradient at each point in \a cloud
123
* \param[in] p_idx the index of the query point in \a cloud (i.e. the center of the neighborhood)
124
* \param[in] radius the radius of the RIFT feature
125
* \param[in] indices the indices of the points that comprise \a p_idx's neighborhood in \a cloud
126
* \param[in] squared_distances the squared distances from the query point to each point in the neighborhood
127
* \param[out] rift_descriptor the resultant RIFT descriptor
128
*/
129
void
130
computeRIFT
(
const
PointCloudIn
&cloud,
const
PointCloudGradient
&gradient,
int
p_idx,
float
radius,
131
const
std::vector<int> &indices,
const
std::vector<float> &squared_distances,
132
Eigen::MatrixXf &rift_descriptor);
133
134
protected
:
135
136
/** \brief Estimate the Rotation Invariant Feature Transform (RIFT) descriptors at a set of points given by
137
* <setInputCloud (), setIndices ()> using the surface in setSearchSurface (), the gradient in
138
* setInputGradient (), and the spatial locator in setSearchMethod ()
139
* \param[out] output the resultant point cloud model dataset that contains the RIFT feature estimates
140
*/
141
void
142
computeFeature
(
PointCloudOut
&output);
143
144
/** \brief The intensity gradient of the input point cloud data*/
145
PointCloudGradientConstPtr
gradient_
;
146
147
/** \brief The number of distance bins in the descriptor. */
148
int
nr_distance_bins_
;
149
150
/** \brief The number of gradient orientation bins in the descriptor. */
151
int
nr_gradient_bins_
;
152
};
153
}
154
155
#ifdef PCL_NO_PRECOMPILE
156
#include <pcl/features/impl/rift.hpp>
157
#endif
158
159
#endif // #ifndef PCL_RIFT_H_