Point Cloud Library (PCL)  1.7.0
normal_based_signature.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2011, Alexandru-Eugen Ichim
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 #ifndef PCL_NORMAL_BASED_SIGNATURE_H_
41 #define PCL_NORMAL_BASED_SIGNATURE_H_
42 
43 #include <pcl/features/feature.h>
44 
45 namespace pcl
46 {
47  /** \brief Normal-based feature signature estimation class. Obtains the feature vector by applying Discrete Cosine and
48  * Fourier Transforms on an NxM array of real numbers representing the projection distances of the points in the input
49  * cloud to a disc around the point of interest.
50  * Please consult the following publication for more details:
51  * Xinju Li and Igor Guskov
52  * Multi-scale features for approximate alignment of point-based surfaces
53  * Proceedings of the third Eurographics symposium on Geometry processing
54  * July 2005, Vienna, Austria
55  *
56  * \note These features were meant to be used at keypoints detected by a detector using different smoothing radii
57  * (e.g., SmoothedSurfacesKeypoint)
58  * \author Alexandru-Eugen Ichim
59  */
60  template <typename PointT, typename PointNT, typename PointFeature>
61  class NormalBasedSignatureEstimation : public FeatureFromNormals<PointT, PointNT, PointFeature>
62  {
63  public:
69 
71  typedef typename boost::shared_ptr<NormalBasedSignatureEstimation<PointT, PointNT, PointFeature> > Ptr;
72  typedef typename boost::shared_ptr<const NormalBasedSignatureEstimation<PointT, PointNT, PointFeature> > ConstPtr;
73 
74 
75 
76  /** \brief Empty constructor, initializes the internal parameters to the default values
77  */
79  : FeatureFromNormals<PointT, PointNT, PointFeature> (),
80  scale_h_ (),
81  N_ (36),
82  M_ (8),
83  N_prime_ (4),
84  M_prime_ (3)
85  {
86  }
87 
88  /** \brief Setter method for the N parameter - the length of the columns used for the Discrete Fourier Transform.
89  * \param[in] n the length of the columns used for the Discrete Fourier Transform.
90  */
91  inline void
92  setN (size_t n) { N_ = n; }
93 
94  /** \brief Returns the N parameter - the length of the columns used for the Discrete Fourier Transform. */
95  inline size_t
96  getN () { return N_; }
97 
98  /** \brief Setter method for the M parameter - the length of the rows used for the Discrete Cosine Transform.
99  * \param[in] m the length of the rows used for the Discrete Cosine Transform.
100  */
101  inline void
102  setM (size_t m) { M_ = m; }
103 
104  /** \brief Returns the M parameter - the length of the rows used for the Discrete Cosine Transform */
105  inline size_t
106  getM () { return M_; }
107 
108  /** \brief Setter method for the N' parameter - the number of columns to be taken from the matrix of DFT and DCT
109  * values that will be contained in the output feature vector
110  * \note This value directly influences the dimensions of the type of output points (PointFeature)
111  * \param[in] n_prime the number of columns from the matrix of DFT and DCT that will be contained in the output
112  */
113  inline void
114  setNPrime (size_t n_prime) { N_prime_ = n_prime; }
115 
116  /** \brief Returns the N' parameter - the number of rows to be taken from the matrix of DFT and DCT
117  * values that will be contained in the output feature vector
118  * \note This value directly influences the dimensions of the type of output points (PointFeature)
119  */
120  inline size_t
121  getNPrime () { return N_prime_; }
122 
123  /** \brief Setter method for the M' parameter - the number of rows to be taken from the matrix of DFT and DCT
124  * values that will be contained in the output feature vector
125  * \note This value directly influences the dimensions of the type of output points (PointFeature)
126  * \param[in] m_prime the number of rows from the matrix of DFT and DCT that will be contained in the output
127  */
128  inline void
129  setMPrime (size_t m_prime) { M_prime_ = m_prime; }
130 
131  /** \brief Returns the M' parameter - the number of rows to be taken from the matrix of DFT and DCT
132  * values that will be contained in the output feature vector
133  * \note This value directly influences the dimensions of the type of output points (PointFeature)
134  */
135  inline size_t
136  getMPrime () { return M_prime_; }
137 
138  /** \brief Setter method for the scale parameter - used to determine the radius of the sampling disc around the
139  * point of interest - linked to the smoothing scale of the input cloud
140  */
141  inline void
142  setScale (float scale) { scale_h_ = scale; }
143 
144  /** \brief Returns the scale parameter - used to determine the radius of the sampling disc around the
145  * point of interest - linked to the smoothing scale of the input cloud
146  */
147  inline float
148  getScale () { return scale_h_; }
149 
150 
151  protected:
152  void
153  computeFeature (FeatureCloud &output);
154 
155  private:
156  float scale_h_;
157  size_t N_, M_, N_prime_, M_prime_;
158  };
159 }
160 
161 #ifdef PCL_NO_PRECOMPILE
162 #include <pcl/features/impl/normal_based_signature.hpp>
163 #endif
164 
165 #endif /* PCL_NORMAL_BASED_SIGNATURE_H_ */