Point Cloud Library (PCL)  1.9.1
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> ()
100  {
101  setNumberOfThreads(nr_threads);
102  };
103 
104  /** \brief Initialize the scheduler and set the number of threads to use.
105  * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
106  */
107  void
108  setNumberOfThreads (unsigned int nr_threads = 0);
109 
110  protected:
111 
112  /** \brief Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by
113  * <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in
114  * setSearchMethod ()
115  * \param output the resultant point cloud model dataset that contains the SHOT feature estimates
116  */
117  void
118  computeFeature (PointCloudOut &output);
119 
120  /** \brief This method should get called before starting the actual computation. */
121  bool
122  initCompute ();
123 
124  /** \brief The number of threads the scheduler should use. */
125  unsigned int threads_;
126  };
127 
128  /** \brief SHOTColorEstimationOMP estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given point cloud dataset
129  * containing points, normals and colors, in parallel, using the OpenMP standard.
130  *
131  * The suggested PointOutT is pcl::SHOT1344.
132  *
133  * \note If you use this code in any academic work, please cite:
134  *
135  * - F. Tombari, S. Salti, L. Di Stefano
136  * Unique Signatures of Histograms for Local Surface Description.
137  * In Proceedings of the 11th European Conference on Computer Vision (ECCV),
138  * Heraklion, Greece, September 5-11 2010.
139  * - F. Tombari, S. Salti, L. Di Stefano
140  * A Combined Texture-Shape Descriptor For Enhanced 3D Feature Matching.
141  * In Proceedings of the 18th International Conference on Image Processing (ICIP),
142  * Brussels, Belgium, September 11-14 2011.
143  *
144  * \author Samuele Salti
145  * \ingroup features
146  */
147 
148  template <typename PointInT, typename PointNT, typename PointOutT = pcl::SHOT1344, typename PointRFT = pcl::ReferenceFrame>
149  class SHOTColorEstimationOMP : public SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT>
150  {
151  public:
152  typedef boost::shared_ptr<SHOTColorEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> > Ptr;
153  typedef boost::shared_ptr<const SHOTColorEstimationOMP<PointInT, PointNT, PointOutT, PointRFT> > ConstPtr;
176 
179 
180  /** \brief Empty constructor. */
181  SHOTColorEstimationOMP (bool describe_shape = true,
182  bool describe_color = true,
183  unsigned int nr_threads = 0)
184  : SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT> (describe_shape, describe_color)
185  {
186  setNumberOfThreads(nr_threads);
187  }
188 
189  /** \brief Initialize the scheduler and set the number of threads to use.
190  * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
191  */
192  void
193  setNumberOfThreads (unsigned int nr_threads = 0);
194 
195  protected:
196 
197  /** \brief Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by
198  * <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in
199  * setSearchMethod ()
200  * \param output the resultant point cloud model dataset that contains the SHOT feature estimates
201  */
202  void
203  computeFeature (PointCloudOut &output);
204 
205  /** \brief This method should get called before starting the actual computation. */
206  bool
207  initCompute ();
208 
209  /** \brief The number of threads the scheduler should use. */
210  unsigned int threads_;
211  };
212 
213 }
214 
215 #ifdef PCL_NO_PRECOMPILE
216 #include <pcl/features/impl/shot_omp.hpp>
217 #endif
218 
219 #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:153
unsigned int threads_
The number of threads the scheduler should use.
Definition: shot_omp.h:210
SHOTColorEstimation estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a giv...
Definition: shot.h:298
Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition: shot_omp.h:95
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
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.hpp:124
void computeFeature(PointCloudOut &output)
Estimate the Signatures of Histograms of OrienTations (SHOT) descriptors at a set of points given by ...
Definition: shot_omp.hpp:138
SHOTEstimation estimates the Signature of Histograms of OrienTations (SHOT) descriptor for a given po...
Definition: shot.h:220
boost::shared_ptr< SHOTColorEstimationOMP< PointInT, PointNT, PointOutT, PointRFT > > Ptr
Definition: shot_omp.h:152
Defines all the PCL implemented PointT point type structures.
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:222
SHOTColorEstimationOMP(bool describe_shape=true, bool describe_color=true, unsigned int nr_threads=0)
Empty constructor.
Definition: shot_omp.h:181
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.hpp:208
Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition: shot_omp.h:177
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:178
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:125
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:149