Point Cloud Library (PCL)  1.9.1
fpfh_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  * $Id$
38  *
39  */
40 
41 #ifndef PCL_FPFH_OMP_H_
42 #define PCL_FPFH_OMP_H_
43 
44 #include <pcl/features/feature.h>
45 #include <pcl/features/fpfh.h>
46 
47 namespace pcl
48 {
49  /** \brief FPFHEstimationOMP estimates the Fast Point Feature Histogram (FPFH) descriptor for a given point cloud
50  * dataset containing points and normals, in parallel, using the OpenMP standard.
51  *
52  * \note If you use this code in any academic work, please cite:
53  *
54  * - R.B. Rusu, N. Blodow, M. Beetz.
55  * Fast Point Feature Histograms (FPFH) for 3D Registration.
56  * In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA),
57  * Kobe, Japan, May 12-17 2009.
58  * - R.B. Rusu, A. Holzbach, N. Blodow, M. Beetz.
59  * Fast Geometric Point Labeling using Conditional Random Fields.
60  * In Proceedings of the 22nd IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS),
61  * St. Louis, MO, USA, October 11-15 2009.
62  *
63  * \attention
64  * The convention for FPFH features is:
65  * - if a query point's nearest neighbors cannot be estimated, the FPFH feature will be set to NaN
66  * (not a number)
67  * - it is impossible to estimate a FPFH descriptor for a point that
68  * doesn't have finite 3D coordinates. Therefore, any point that contains
69  * NaN data on x, y, or z, will have its FPFH feature property set to NaN.
70  *
71  * \author Radu B. Rusu
72  * \ingroup features
73  */
74  template <typename PointInT, typename PointNT, typename PointOutT>
75  class FPFHEstimationOMP : public FPFHEstimation<PointInT, PointNT, PointOutT>
76  {
77  public:
78  typedef boost::shared_ptr<FPFHEstimationOMP<PointInT, PointNT, PointOutT> > Ptr;
79  typedef boost::shared_ptr<const FPFHEstimationOMP<PointInT, PointNT, PointOutT> > ConstPtr;
92 
94 
95  /** \brief Initialize the scheduler and set the number of threads to use.
96  * \param[in] nr_threads the number of hardware threads to use (0 sets the value back to automatic)
97  */
98  FPFHEstimationOMP (unsigned int nr_threads = 0) : nr_bins_f1_ (11), nr_bins_f2_ (11), nr_bins_f3_ (11)
99  {
100  feature_name_ = "FPFHEstimationOMP";
101 
102  setNumberOfThreads(nr_threads);
103  }
104 
105  /** \brief Initialize the scheduler and set the number of threads to use.
106  * \param[in] nr_threads the number of hardware threads to use (0 sets the value back to automatic)
107  */
108  void
109  setNumberOfThreads (unsigned int nr_threads = 0);
110 
111  private:
112  /** \brief Estimate the Fast Point Feature Histograms (FPFH) 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[out] output the resultant point cloud model dataset that contains the FPFH feature estimates
116  */
117  void
118  computeFeature (PointCloudOut &output);
119 
120  public:
121  /** \brief The number of subdivisions for each angular feature interval. */
123  private:
124  /** \brief The number of threads the scheduler should use. */
125  unsigned int threads_;
126  };
127 }
128 
129 #ifdef PCL_NO_PRECOMPILE
130 #include <pcl/features/impl/fpfh_omp.hpp>
131 #endif
132 
133 #endif //#ifndef PCL_FPFH_OMP_H_
std::string feature_name_
The feature name.
Definition: feature.h:222
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition: fpfh_omp.h:93
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
Definition: fpfh_omp.hpp:48
FPFHEstimation estimates the Fast Point Feature Histogram (FPFH) descriptor for a given point cloud d...
Definition: fpfh.h:80
PointCloud represents the base class in PCL for storing collections of 3D points.
boost::shared_ptr< FPFHEstimationOMP< PointInT, PointNT, PointOutT > > Ptr
Definition: fpfh_omp.h:78
int nr_bins_f1_
The number of subdivisions for each angular feature interval.
Definition: fpfh_omp.h:122
Feature represents the base feature class.
Definition: feature.h:105
FPFHEstimationOMP estimates the Fast Point Feature Histogram (FPFH) descriptor for a given point clou...
Definition: fpfh_omp.h:75
boost::shared_ptr< const FPFHEstimationOMP< PointInT, PointNT, PointOutT > > ConstPtr
Definition: fpfh_omp.h:79
FPFHEstimationOMP(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
Definition: fpfh_omp.h:98