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