Point Cloud Library (PCL)  1.7.0
shot_omp.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2009, 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  *
38  */
39 
40 #ifndef PCL_SHOT_OMP_H_
41 #define PCL_SHOT_OMP_H_
42 
43 #include <pcl/point_types.h>
44 #include <pcl/features/feature.h>
45 #include <pcl/features/shot.h>
46 
47 namespace pcl
48 {
49  /** \brief SHOTEstimationOMP estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given point cloud dataset
50  * containing points and normals, in parallel, using the OpenMP standard.
51  *
52  * The suggested PointOutT is pcl::SHOT352.
53  *
54  * \note If you use this code in any academic work, please cite:
55  *
56  * - F. Tombari, S. Salti, L. Di Stefano
57  * Unique Signatures of Histograms for Local Surface Description.
58  * In Proceedings of the 11th European Conference on Computer Vision (ECCV),
59  * Heraklion, Greece, September 5-11 2010.
60  * - F. Tombari, S. Salti, L. Di Stefano
61  * A Combined Texture-Shape Descriptor For Enhanced 3D Feature Matching.
62  * In Proceedings of the 18th International Conference on Image Processing (ICIP),
63  * Brussels, Belgium, September 11-14 2011.
64  *
65  * \author Samuele Salti
66  * \ingroup features
67  */
68 
69  template <typename PointInT, typename PointNT, typename PointOutT = pcl::SHOT352, typename PointRFT = pcl::ReferenceFrame>
70  class SHOTEstimationOMP : public SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT>
71  {
72  public:
73  typedef boost::shared_ptr<SHOTEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> > Ptr;
74  typedef boost::shared_ptr<const SHOTEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> > ConstPtr;
94 
97 
98  /** \brief Empty constructor. */
99  SHOTEstimationOMP (unsigned int nr_threads = 0) : SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT> (), threads_ (nr_threads)
100  { };
101  /** \brief Initialize the scheduler and set the number of threads to use.
102  * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
103  */
104  inline void
105  setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; }
106 
107  protected:
108 
109  /** \brief Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by
110  * <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in
111  * setSearchMethod ()
112  * \param output the resultant point cloud model dataset that contains the SHOT feature estimates
113  */
114  void
115  computeFeature (PointCloudOut &output);
116 
117  /** \brief This method should get called before starting the actual computation. */
118  bool
119  initCompute ();
120 
121  /** \brief The number of threads the scheduler should use. */
122  unsigned int threads_;
123  };
124 
125  /** \brief SHOTColorEstimationOMP estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given point cloud dataset
126  * containing points, normals and colors, in parallel, using the OpenMP standard.
127  *
128  * The suggested PointOutT is pcl::SHOT1344.
129  *
130  * \note If you use this code in any academic work, please cite:
131  *
132  * - F. Tombari, S. Salti, L. Di Stefano
133  * Unique Signatures of Histograms for Local Surface Description.
134  * In Proceedings of the 11th European Conference on Computer Vision (ECCV),
135  * Heraklion, Greece, September 5-11 2010.
136  * - F. Tombari, S. Salti, L. Di Stefano
137  * A Combined Texture-Shape Descriptor For Enhanced 3D Feature Matching.
138  * In Proceedings of the 18th International Conference on Image Processing (ICIP),
139  * Brussels, Belgium, September 11-14 2011.
140  *
141  * \author Samuele Salti
142  * \ingroup features
143  */
144 
145  template <typename PointInT, typename PointNT, typename PointOutT = pcl::SHOT1344, typename PointRFT = pcl::ReferenceFrame>
146  class SHOTColorEstimationOMP : public SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>
147  {
148  public:
149  typedef boost::shared_ptr<SHOTColorEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> > Ptr;
150  typedef boost::shared_ptr<const SHOTColorEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> > ConstPtr;
173 
176 
177  /** \brief Empty constructor. */
178  SHOTColorEstimationOMP (bool describe_shape = true,
179  bool describe_color = true,
180  unsigned int nr_threads = 0)
181  : SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT> (describe_shape, describe_color), threads_ (nr_threads)
182  {
183  }
184 
185  /** \brief Initialize the scheduler and set the number of threads to use.
186  * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
187  */
188  inline void
189  setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; }
190 
191  protected:
192 
193  /** \brief Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by
194  * <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in
195  * setSearchMethod ()
196  * \param output the resultant point cloud model dataset that contains the SHOT feature estimates
197  */
198  void
199  computeFeature (PointCloudOut &output);
200 
201  /** \brief This method should get called before starting the actual computation. */
202  bool
203  initCompute ();
204 
205  /** \brief The number of threads the scheduler should use. */
206  unsigned int threads_;
207  };
208 
209 }
210 
211 #ifdef PCL_NO_PRECOMPILE
212 #include <pcl/features/impl/shot_omp.hpp>
213 #endif
214 
215 #endif //#ifndef PCL_SHOT_OMP_H_
boost::shared_ptr< const SHOTEstimationOMP< PointInT, PointNT, PointOutT, PointRFT > > ConstPtr
Definition: shot_omp.h:74
SHOTEstimationOMP(unsigned int nr_threads=0)
Empty constructor.
Definition: shot_omp.h:99
bool initCompute()
This method should get called before starting the actual computation.
Definition: shot_omp.hpp:48
boost::shared_ptr< SHOTEstimationOMP< PointInT, PointNT, PointOutT, PointRFT > > Ptr
Definition: shot_omp.h:73
boost::shared_ptr< const SHOTColorEstimationOMP< PointInT, PointNT, PointOutT, PointRFT > > ConstPtr
Definition: shot_omp.h:150
unsigned int threads_
The number of threads the scheduler should use.
Definition: shot_omp.h:206
SHOTColorEstimation estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a giv...
Definition: shot.h:299
Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition: shot_omp.h:95
Feature< PointInT, PointOutT >::PointCloudIn PointCloudIn
Definition: shot_omp.h:96
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
Definition: shot_omp.h:105
void computeFeature(PointCloudOut &output)
Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by ...
Definition: shot_omp.hpp:124
SHOTEstimation estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given po...
Definition: shot.h:221
boost::shared_ptr< SHOTColorEstimationOMP< PointInT, PointNT, PointOutT, PointRFT > > Ptr
Definition: shot_omp.h:149
PointCloud represents the base class in PCL for storing collections of 3D points. ...
void computeFeature(PointCloudOut &output)
Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by ...
Definition: shot_omp.hpp:194
SHOTColorEstimationOMP(bool describe_shape=true, bool describe_color=true, unsigned int nr_threads=0)
Empty constructor.
Definition: shot_omp.h:178
SHOTEstimation estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given po...
Definition: shot.h:68
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
Definition: shot_omp.h:189
Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition: shot_omp.h:174
SHOTEstimationOMP estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given...
Definition: shot_omp.h:70
Feature< PointInT, PointOutT >::PointCloudIn PointCloudIn
Definition: shot_omp.h:175
bool initCompute()
This method should get called before starting the actual computation.
Definition: shot_omp.hpp:86
Feature represents the base feature class.
Definition: feature.h:105
unsigned int threads_
The number of threads the scheduler should use.
Definition: shot_omp.h:122
FeatureWithLocalReferenceFrames provides a public interface for descriptor extractor classes which ne...
Definition: feature.h:447
SHOTColorEstimationOMP estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a ...
Definition: shot_omp.h:146