Point Cloud Library (PCL)  1.11.1-dev
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 #pragma once
42 
43 #include <pcl/features/feature.h>
44 
45 namespace pcl
46 {
47  /** \brief RIFTEstimation estimates the Rotation Invariant Feature Transform descriptors for a given point cloud
48  * dataset containing points and intensity. For more information about the RIFT descriptor, see:
49  *
50  * Svetlana Lazebnik, Cordelia Schmid, and Jean Ponce.
51  * A sparse texture representation using local affine regions.
52  * In IEEE Transactions on Pattern Analysis and Machine Intelligence, volume 27, pages 1265-1278, August 2005.
53  *
54  * \author Michael Dixon
55  * \ingroup features
56  */
57 
58  template <typename PointInT, typename GradientT, typename PointOutT>
59  class RIFTEstimation: public Feature<PointInT, PointOutT>
60  {
61  public:
64 
67 
70 
73 
77 
78  using Ptr = shared_ptr<RIFTEstimation<PointInT, GradientT, PointOutT> >;
79  using ConstPtr = shared_ptr<const RIFTEstimation<PointInT, GradientT, PointOutT> >;
80 
81 
82  /** \brief Empty constructor. */
84  {
85  feature_name_ = "RIFTEstimation";
86  };
87 
88  /** \brief Provide a pointer to the input gradient data
89  * \param[in] gradient a pointer to the input gradient data
90  */
91  inline void
92  setInputGradient (const PointCloudGradientConstPtr &gradient) { gradient_ = gradient; };
93 
94  /** \brief Returns a shared pointer to the input gradient data */
96  getInputGradient () const { return (gradient_); };
97 
98  /** \brief Set the number of bins to use in the distance dimension of the RIFT descriptor
99  * \param[in] nr_distance_bins the number of bins to use in the distance dimension of the RIFT descriptor
100  */
101  inline void
102  setNrDistanceBins (int nr_distance_bins) { nr_distance_bins_ = nr_distance_bins; };
103 
104  /** \brief Returns the number of bins in the distance dimension of the RIFT descriptor. */
105  inline int
106  getNrDistanceBins () const { return (nr_distance_bins_); };
107 
108  /** \brief Set the number of bins to use in the gradient orientation dimension of the RIFT descriptor
109  * \param[in] nr_gradient_bins the number of bins to use in the gradient orientation dimension of the RIFT descriptor
110  */
111  inline void
112  setNrGradientBins (int nr_gradient_bins) { nr_gradient_bins_ = nr_gradient_bins; };
113 
114  /** \brief Returns the number of bins in the gradient orientation dimension of the RIFT descriptor. */
115  inline int
116  getNrGradientBins () const { return (nr_gradient_bins_); };
117 
118  /** \brief Estimate the Rotation Invariant Feature Transform (RIFT) descriptor for a given point based on its
119  * spatial neighborhood of 3D points and the corresponding intensity gradient vector field
120  * \param[in] cloud the dataset containing the Cartesian coordinates of the points
121  * \param[in] gradient the dataset containing the intensity gradient at each point in \a cloud
122  * \param[in] p_idx the index of the query point in \a cloud (i.e. the center of the neighborhood)
123  * \param[in] radius the radius of the RIFT feature
124  * \param[in] indices the indices of the points that comprise \a p_idx's neighborhood in \a cloud
125  * \param[in] squared_distances the squared distances from the query point to each point in the neighborhood
126  * \param[out] rift_descriptor the resultant RIFT descriptor
127  */
128  void
129  computeRIFT (const PointCloudIn &cloud, const PointCloudGradient &gradient, int p_idx, float radius,
130  const pcl::Indices &indices, const std::vector<float> &squared_distances,
131  Eigen::MatrixXf &rift_descriptor);
132 
133  protected:
134 
135  /** \brief Estimate the Rotation Invariant Feature Transform (RIFT) descriptors at a set of points given by
136  * <setInputCloud (), setIndices ()> using the surface in setSearchSurface (), the gradient in
137  * setInputGradient (), and the spatial locator in setSearchMethod ()
138  * \param[out] output the resultant point cloud model dataset that contains the RIFT feature estimates
139  */
140  void
141  computeFeature (PointCloudOut &output) override;
142 
143  /** \brief The intensity gradient of the input point cloud data*/
145 
146  /** \brief The number of distance bins in the descriptor. */
148 
149  /** \brief The number of gradient orientation bins in the descriptor. */
151  };
152 }
153 
154 #ifdef PCL_NO_PRECOMPILE
155 #include <pcl/features/impl/rift.hpp>
156 #endif
pcl
Definition: convolution.h:46
pcl::Feature::Ptr
shared_ptr< Feature< PointInT, PointOutT > > Ptr
Definition: feature.h:114
pcl::RIFTEstimation::setNrDistanceBins
void setNrDistanceBins(int nr_distance_bins)
Set the number of bins to use in the distance dimension of the RIFT descriptor.
Definition: rift.h:102
pcl::RIFTEstimation::nr_distance_bins_
int nr_distance_bins_
The number of distance bins in the descriptor.
Definition: rift.h:147
pcl::RIFTEstimation
RIFTEstimation estimates the Rotation Invariant Feature Transform descriptors for a given point cloud...
Definition: rift.h:59
pcl::RIFTEstimation::getNrDistanceBins
int getNrDistanceBins() const
Returns the number of bins in the distance dimension of the RIFT descriptor.
Definition: rift.h:106
pcl::RIFTEstimation::PointCloudGradientPtr
typename PointCloudGradient::Ptr PointCloudGradientPtr
Definition: rift.h:75
pcl::RIFTEstimation::RIFTEstimation
RIFTEstimation()
Empty constructor.
Definition: rift.h:83
pcl::RIFTEstimation::PointCloudGradientConstPtr
typename PointCloudGradient::ConstPtr PointCloudGradientConstPtr
Definition: rift.h:76
pcl::PointCloud< PointInT >
pcl::Feature::ConstPtr
shared_ptr< const Feature< PointInT, PointOutT > > ConstPtr
Definition: feature.h:115
pcl::RIFTEstimation::computeRIFT
void computeRIFT(const PointCloudIn &cloud, const PointCloudGradient &gradient, int p_idx, float radius, const pcl::Indices &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
pcl::RIFTEstimation::gradient_
PointCloudGradientConstPtr gradient_
The intensity gradient of the input point cloud data.
Definition: rift.h:144
pcl::RIFTEstimation::PointCloudGradient
pcl::PointCloud< GradientT > PointCloudGradient
Definition: rift.h:74
pcl::RIFTEstimation::PointCloudOut
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition: rift.h:72
pcl::RIFTEstimation::PointCloudIn
pcl::PointCloud< PointInT > PointCloudIn
Definition: rift.h:71
pcl::RIFTEstimation::nr_gradient_bins_
int nr_gradient_bins_
The number of gradient orientation bins in the descriptor.
Definition: rift.h:150
pcl::RIFTEstimation::setNrGradientBins
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:112
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition: types.h:131
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:407
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:408
pcl::RIFTEstimation::setInputGradient
void setInputGradient(const PointCloudGradientConstPtr &gradient)
Provide a pointer to the input gradient data.
Definition: rift.h:92
pcl::RIFTEstimation::getNrGradientBins
int getNrGradientBins() const
Returns the number of bins in the gradient orientation dimension of the RIFT descriptor.
Definition: rift.h:116
pcl::Feature::feature_name_
std::string feature_name_
The feature name.
Definition: feature.h:223
pcl::RIFTEstimation::computeFeature
void computeFeature(PointCloudOut &output) override
Estimate the Rotation Invariant Feature Transform (RIFT) descriptors at a set of points given by <set...
Definition: rift.hpp:113
pcl::RIFTEstimation::getInputGradient
PointCloudGradientConstPtr getInputGradient() const
Returns a shared pointer to the input gradient data.
Definition: rift.h:96
pcl::Feature
Feature represents the base feature class.
Definition: feature.h:106