Point Cloud Library (PCL)  1.7.1
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 PointInT, typename GradientT, typename PointOutT>
60  class RIFTEstimation: public Feature<PointInT, PointOutT>
61  {
62  public:
65 
68 
71 
74 
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. */
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 */
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*/
146 
147  /** \brief The number of distance bins in the descriptor. */
149 
150  /** \brief The number of gradient orientation bins in the descriptor. */
152  };
153 }
154 
155 #ifdef PCL_NO_PRECOMPILE
156 #include <pcl/features/impl/rift.hpp>
157 #endif
158 
159 #endif // #ifndef PCL_RIFT_H_
pcl::PointCloud< GradientT > PointCloudGradient
Definition: rift.h:75
PointCloudGradientConstPtr getInputGradient() const
Returns a shared pointer to the input gradient data.
Definition: rift.h:97
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:429
boost::shared_ptr< const RIFTEstimation< PointInT, GradientT, PointOutT > > ConstPtr
Definition: rift.h:80
RIFTEstimation()
Empty constructor.
Definition: rift.h:84
boost::shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:428
std::string feature_name_
The feature name.
Definition: feature.h:222
int getNrDistanceBins() const
Returns the number of bins in the distance dimension of the RIFT descriptor.
Definition: rift.h:107
PointCloudGradientConstPtr gradient_
The intensity gradient of the input point cloud data.
Definition: rift.h:145
int nr_distance_bins_
The number of distance bins in the descriptor.
Definition: rift.h:148
void setNrDistanceBins(int nr_distance_bins)
Set the number of bins to use in the distance dimension of the RIFT descriptor.
Definition: rift.h:103
Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition: rift.h:73
void computeRIFT(const PointCloudIn &cloud, const PointCloudGradient &gradient, int p_idx, float radius, const std::vector< int > &indices, const std::vector< float > &squared_distances, Eigen::MatrixXf &rift_descriptor)
Estimate the Rotation Invariant Feature Transform (RIFT) descriptor for a given point based on its sp...
Definition: rift.hpp:48
void computeFeature(PointCloudOut &output)
Estimate the Rotation Invariant Feature Transform (RIFT) descriptors at a set of points given by <set...
Definition: rift.hpp:113
void setInputGradient(const PointCloudGradientConstPtr &gradient)
Provide a pointer to the input gradient data.
Definition: rift.h:93
RIFTEstimation estimates the Rotation Invariant Feature Transform descriptors for a given point cloud...
Definition: rift.h:60
PointCloudGradient::Ptr PointCloudGradientPtr
Definition: rift.h:76
void setNrGradientBins(int nr_gradient_bins)
Set the number of bins to use in the gradient orientation dimension of the RIFT descriptor.
Definition: rift.h:113
pcl::PointCloud< PointInT > PointCloudIn
Definition: rift.h:72
Feature represents the base feature class.
Definition: feature.h:105
boost::shared_ptr< RIFTEstimation< PointInT, GradientT, PointOutT > > Ptr
Definition: rift.h:79
PointCloudGradient::ConstPtr PointCloudGradientConstPtr
Definition: rift.h:77
int nr_gradient_bins_
The number of gradient orientation bins in the descriptor.
Definition: rift.h:151
int getNrGradientBins() const
Returns the number of bins in the gradient orientation dimension of the RIFT descriptor.
Definition: rift.h:117