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