Point Cloud Library (PCL)  1.14.1-dev
statistical_multiscale_interest_region_extraction.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2011, Alexandru-Eugen Ichim
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 #pragma once
41 
42 #include <pcl/pcl_base.h>
43 #include <list>
44 
45 namespace pcl
46 {
47  /** \brief Class for extracting interest regions from unstructured point clouds, based on a multi scale
48  * statistical approach.
49  * Please refer to the following publications for more details:
50  * Ranjith Unnikrishnan and Martial Hebert
51  * Multi-Scale Interest Regions from Unorganized Point Clouds
52  * Workshop on Search in 3D (S3D), IEEE Conf. on Computer Vision and Pattern Recognition (CVPR)
53  * June, 2008
54  *
55  * Statistical Approaches to Multi-scale Point Cloud Processing
56  * Ranjith Unnikrishnan
57  * PhD Thesis
58  * The Robotics Institute Carnegie Mellon University
59  * May, 2008
60  *
61  * \author Alexandru-Eugen Ichim
62  */
63  template <typename PointT>
65  {
66  public:
67  using IndicesPtr = shared_ptr<pcl::Indices >;
68  using Ptr = shared_ptr<StatisticalMultiscaleInterestRegionExtraction<PointT> >;
69  using ConstPtr = shared_ptr<const StatisticalMultiscaleInterestRegionExtraction<PointT> >;
70 
71 
72  /** \brief Empty constructor */
74 
75  /** \brief Method that generates the underlying nearest neighbor graph based on the
76  * input point cloud
77  */
78  void
80 
81  /** \brief The method to be called in order to run the algorithm and produce the resulting
82  * set of regions of interest
83  */
84  void
85  computeRegionsOfInterest (std::list<IndicesPtr>& rois);
86 
87  /** \brief Method for setting the scale parameters for the algorithm
88  * \param scale_values vector of scales to determine the size of each scaling step
89  */
90  inline void
91  setScalesVector (std::vector<float> &scale_values) { scale_values_ = scale_values; }
92 
93  /** \brief Method for getting the scale parameters vector */
94  inline std::vector<float>
95  getScalesVector () { return scale_values_; }
96 
97 
98  private:
99  /** \brief Checks if all the necessary input was given and the computations can successfully start */
100  bool
101  initCompute ();
102 
103  void
104  geodesicFixedRadiusSearch (std::size_t &query_index,
105  float &radius,
106  std::vector<int> &result_indices);
107 
108  void
109  computeF ();
110 
111  void
112  extractExtrema (std::list<IndicesPtr>& rois);
113 
116  std::vector<float> scale_values_;
117  std::vector<std::vector<float> > geodesic_distances_;
118  std::vector<std::vector<float> > F_scales_;
119  };
120 }
121 
122 
123 #ifdef PCL_NO_PRECOMPILE
124 #include <pcl/features/impl/statistical_multiscale_interest_region_extraction.hpp>
125 #endif
PCL base class.
Definition: pcl_base.h:70
Class for extracting interest regions from unstructured point clouds, based on a multi scale statisti...
void computeRegionsOfInterest(std::list< IndicesPtr > &rois)
The method to be called in order to run the algorithm and produce the resulting set of regions of int...
shared_ptr< StatisticalMultiscaleInterestRegionExtraction< PointT > > Ptr
void generateCloudGraph()
Method that generates the underlying nearest neighbor graph based on the input point cloud.
StatisticalMultiscaleInterestRegionExtraction()=default
Empty constructor.
void setScalesVector(std::vector< float > &scale_values)
Method for setting the scale parameters for the algorithm.
shared_ptr< const StatisticalMultiscaleInterestRegionExtraction< PointT > > ConstPtr
std::vector< float > getScalesVector()
Method for getting the scale parameters vector.