1 /*
2  * Software License Agreement (BSD License)
3  *
4  *  Point Cloud Library (PCL) - www.pointclouds.org
5  *  Copyright (c) 2010, 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 #pragma once
39 
40 #include <pcl/point_types.h>
41 #include <pcl/features/feature.h>
42 
43 namespace pcl
44 {
45   // Forward declarations
46   class RangeImage;
47 
48   /** @b Computes NARF feature descriptors for points in a range image
49     * See B. Steder, R. B. Rusu, K. Konolige, and W. Burgard
50     *     Point Feature Extraction on 3D Range Scans Taking into Account Object Boundaries
51     *     In Proc. of the IEEE Int. Conf. on Robotics &Automation (ICRA). 2011.
52     * \author Bastian Steder
53     * \ingroup features
54     */
55   class PCL_EXPORTS NarfDescriptor : public Feature<PointWithRange,Narf36>
56   {
57     public:
58       using Ptr = shared_ptr<NarfDescriptor>;
59       using ConstPtr = shared_ptr<const NarfDescriptor>;
60       // =====TYPEDEFS=====
61       using BaseClass = Feature<PointWithRange,Narf36>;
62 
63       // =====STRUCTS/CLASSES=====
64       struct Parameters
65       {
ParametersParameters66         Parameters() : support_size(-1.0f), rotation_invariant(true) {}
67         float support_size;
68         bool rotation_invariant;
69       };
70 
71       // =====CONSTRUCTOR & DESTRUCTOR=====
72       /** Constructor */
73       NarfDescriptor (const RangeImage* range_image=nullptr, const pcl::Indices* indices=nullptr);
74       /** Destructor */
75       ~NarfDescriptor();
76 
77       // =====METHODS=====
78       //! Set input data
79       void
80       setRangeImage (const RangeImage* range_image, const pcl::Indices* indices=nullptr);
81 
82       //! Overwrite the compute function of the base class
83       void
84       compute (PointCloudOut& output);
85 
86       // =====GETTER=====
87       //! Get a reference to the parameters struct
88       Parameters&
getParameters()89       getParameters () { return parameters_;}
90 
91     protected:
92       // =====PROTECTED MEMBER VARIABLES=====
93       const RangeImage* range_image_;
94       Parameters parameters_;
95 
96       // =====PROTECTED METHODS=====
97       /** Implementation of abstract derived function */
98       void
99       computeFeature (PointCloudOut& output) override;
100   };
101 
102 }  // namespace end
103