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